17

I am trying to use multiple parameters to find 3 different extensions in my windows/system32 in one command: .exe, .dll and .sys

This is giving me what I want, but I can't figure out how to get all 3 extensions in a single command:

dir c:\windows\system32\*.dll /p

5 Answers 5

17

This will do it in a single command:

dir /p c:\windows\system32\*.exe c:\windows\system32\*.dll c:\windows\system32\*.sys

A lot of people dont realize that you can have multiple sources in the dir command

2
5

If you mean listing files that have one of three extensions, you should start with:

dir *.exe *.dll *.sys
4
  • I have to find all files with those 3 extensions with a pause between screens /p all in one command prompt
    – Anonymous
    Oct 20, 2010 at 2:06
  • FWIW, "dir c:\windows\system32\*.dll c:\windows\system32\*.exe c:\windows\system32\*.sys /p" works on Windows 7 Oct 20, 2010 at 2:55
  • dir *.exe *.dll *.sys /s /p will search all subdirectories with a pause in between each screen
    – Enigman
    Jan 23, 2013 at 4:01
  • After reading unix.stackexchange.com/a/157299/8763 I got curious if I could ever do the same thing on Windows batch files.
    – sergiol
    Aug 19, 2016 at 10:45
1

make this a batch file (.bat) and run it from the command prompt

@echo off

dir c:\windows\system32\*.dll
pause
dir c:\windows\system32\*.exe
pause
dir c:\windows\system32\*.sys
1
  • I upvoted, not sure if a batch file satisfies his requirement though. My answer would definitely work
    – Keltari
    Jan 23, 2013 at 3:55
1

Another option is to Change Directory && then do the lookup

cd c:\windows\system32 && dir *.exe *.dll *.sys

Saves a bit of typing...

0

To open multiple files with the same extension using the for loop for /R %i in (*.html) do start %i

The /R switch of the for loop in batch is used to loop through directories. You can use it with a file path or without one. When used without a file path, it assumes the current directory and searches with depth. You can use the command for /? to read about other use cases.

You must log in to answer this question.