How do I store the full filename matching a wildcard into a batch file variable?
I want to write a Windows/DOS batch file for Windows XP, Vista, and Windows 7. In a given directory, I will have a single file that matches, "selenium*.jar". How do I store the full file name in a variable and then invoke it in a command? What I want to do in pseudocode is
var FILE=/* Get name of selenium JAR file */
java -ja开发者_Go百科r $FILE -userExtensions user_extensions.js
How would I write the above in official DOS batch scripting? Thanks, - Dave
This might work:
FOR %f IN (selenium*.jar) DO java -jar %f -userExtensions user_extensions.js
In a batch (.bat) file, you would write FOR %%f IN ...
.
精彩评论