File Name globbing Windows vs. Unix

Is it possible to use only wildcards in the standard Windows shell?

$ ls -1 003[5,8]0
00350
00380
+5
source share
2 answers

Not in the standard Windows shell (cmd.exe). Does he only understand? and * wildcards; no regular expressions.

Do you have the option to install Cygwin, Windows Powershell, or another advanced shell?

+5
source

Yes, you can. Not with one team, but with a combination of FORand IF. Try this to get you started ...

setlocal enabledelayedexpansion
for %%a in (003?0) do (
  set fn=%%a
  set fnl=!fn:~3,1!
  if .!fnl!==.5 (
    echo !fn!
  )
  if .!fnl!==.8 (
    echo !fn!
  )
)
+2
source

All Articles