for /r

  • Thread starter Thread starter Dave Patrick
  • Start date Start date
D

Dave Patrick

How can I make this only enumerate the system32 directory and not
subdirectories?

for /R %windir%\system32 %x IN (*.dll) DO echo %x >> C:\dave.txt

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
 
Hello, Dave:
On Sun, 5 Dec 2004 20:42:04 -0700: you wrote...

DP> How can I make this only enumerate the system32 directory and not
DP> subdirectories?
DP>
DP> for /R %windir%\system32 %x IN (*.dll) DO echo %x >> C:\dave.txt
DP>

By definition the R switch walks the subdirs. Use this instead:
for /f "tokens=*" %x in ('dir %windir%\system32\*.dll') do @echo %x >>
C:\dave.txt

If DIRCMD includes the /s switch then use this:
for /f "tokens=*" %x in ('dir /-s %windir%\system32\*.dll') do @echo %x >>
C:\dave.txt

Regards, Paul R. Sadowski [MVP].
 
How can I make this only enumerate the system32 directory and not
subdirectories?

for /R %windir%\system32 %x IN (*.dll) DO echo %x >> C:\dave.txt

for %A in (%windir%\system32\*.dll) DO echo %~nxA >> C:\dave.txt

Clay Calvert
(e-mail address removed)
Replace "W" with "L"
 
Thank you Clay and Paul for two workable solutions.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| for %A in (%windir%\system32\*.dll) DO echo %~nxA >> C:\dave.txt
|
| Clay Calvert
| (e-mail address removed)
| Replace "W" with "L"
 
Back
Top