membersound
membersound

Reputation: 86727

How to find a filename using wildcards?

How can I use a cmd batch command to find a filename using wildcard matching?

I want to run the following, where the wildcard should match the one file that is contained in the dir:

SET FILENAME=c:\my-example-file-*.jar
java -jar %FILENAME%

Upvotes: 0

Views: 131

Answers (1)

Alex K.
Alex K.

Reputation: 175766

If you know there is always one, just use a listing:

FOR %%F IN (c:\my-example-file-*.jar) DO java -jar %%F

Upvotes: 1

Related Questions