How to use Windows Command Line Regular Expressions

command-line, command-prompt, regex

Solution

Unlike many Unix shells, the Windows command line processor does not expand wildcards automatically. It is each program's responsibility to expand wildcards as it sees fit. Many programs simply don't support wildcards at all. In those cases you can always create a FOR loop to repeatedly issue the same command on a set of files specified by a wildcard.

e.g. `for %f in (*.txt) do echo %f`

will echo the names of all *.txt files in a directory.

use the help command to get more detailed help on any Windows command. i.e.

help for

As for regular expressions: other than `findstr`, I don't know of any built-in Windows command which supports regular expressions.

Problem

I am having trouble finding how to execute regular expressions in Windows Command Line. I would want to use regular expressions for a number of situations, but basically now all I want to do is open a file with regular expressions in its name. Example: Start s.html works fine, but start *.html does not work. What is needed? Thanks

Original source