What does the foll开发者_JAVA技巧owing %1 means (in a .bat file)?
jsmin <%1 >%2
It represents the first command line argument passed to the batch file.
If you run your batch file with:
myfile.bat firstArg secondArg
%1
becomes "firstArg" and %2
becomes "secondArg"
The related shift
command shifts the position of arguments one to the left. Running shift
once in a batch file will make "%1" value to be the second argument, "%2" becomes the third, and so on. It's useful for processing command line arguments in a loop in the batch file.
%1
is the first argument given, %2
the second.
If you run the file with foo.bat source.js destination.js
, the command run is jsmin <source.js >destination.js
.
精彩评论