3

I was wondering if it is possible to use wildcard characters in Windows Command Prompt. For example, if I want to see all files in a directory ending with .docx, on Linux I would type this ls *.docx. Is there a similar tool in Windows? Thanks

user3124184
  • 31
  • 1
  • 1
  • 2
  • Yes, wildcards work, in a very similar way. The Windows equivalent would be `dir *.docx`. – dlev Dec 20 '13 at 22:05
  • What if I want to print all .docx files in a directory, will this work too? – user3124184 Dec 20 '13 at 22:06
  • Yes, that works, though `print` is only good for text files. – dlev Dec 20 '13 at 22:10
  • I am using this command to print .docx files ""C:/Program Files (x86)/Microsoft Office/Office12/winword" C:/Users/username/Downloads/*.docx /q /n /mFilePrintDefault /mFileExit" – user3124184 Dec 20 '13 at 22:14
  • Open a new question if you have extra things that need to be answered. Questions are free, and SO is designed around a question and answer. – foxidrive Dec 21 '13 at 08:20

1 Answers1

4

yes you can.

e.g.

The asterisk character, *, can stand in for any number of characters. Some examples of this command:

c:\>del *.doc

This command would delete every file with the doc extension from the root directory of C: . So files like myfile.doc, testfile.doc, and 123.doc would all be deleted.

refer to this link:

http://www.ahuka.com/?page_id=31

gaurav5430
  • 12,934
  • 6
  • 54
  • 111
  • 6
    This appears to be something that the command is responsible for doing. If I do `java.exe -jar thisIsMyJar_*` when I have a file called `thisIsMyJar_1.0.jar`, Java spits out an error message: `Unable to access jarfile thisIsMyJar_*`. This is in contrast to most (all?) *nix shells where wildcards are handled after variables are expanded and before passing the arguments to the program that will be run. – ArtOfWarfare May 08 '18 at 20:29