How do you implement a shell-like command to assign a value to a variable under bat?
At first, it was really hard for me. With the familiarity of bat batch knowledge deepened.
Learning to!!!
Give me a chestnut:
Svnlook UUID C:\Repository\test # What do you mean by this line of command? It's a command of the SVN server (because it's been doing SVN stuff lately).
# So the effect of this line of command is to return the UUID of the test repository
This is done under the shell:
Uuid= ' Svnlook uuid C:\Repository\test ' # here is · Oh. This symbol is the one under the keyboard Esc button · (It's so small ........) )
==================================================
OK ~ ~ ~ See, the shell implementation is really very simple, bat under the can be achieved but a bit of trouble.
DOS under: for/f "delims="%t in (' Svnlook uuid C:\Repository\test ') do set uuid=%t
BAT file: for/f "delims="%%t in (' Svnlook uuid C:\Repository\test ') do set uuid=%%t
The difference above is that DOS executes as%t, BAT file execution is%%t.
It is also important to note that the single quotation marks are used in the bat because the single quotation mark is the meaning of the reference command.
The delims here is worth the meaning of the delimiter. What I'm writing here is "delims=". There is no delimiter, so the row is split,
This allows you to take the result of the first line.
Learn this and write bat again. The script is more beautiful and more concise. Can be 10 floors in a breath. Ha ha.
How to assign the effect of command execution to a variable like a shell under a bat batch