Pegasus said:
Perhaps the file does not exist in the folder where you're looking . . .
Apply the standard trouble-shooting procedure: If it does not work,
make it visible!
for /d %a in ("c:\Program Files\s*.*") do echo dir /s /b "%a\program.exe"
Note also:
- You *must* run the command from the Command Prompt, not
from the Start/Run box.
- The command is written so that it gets executed from the Command
Line, which is what you asked for. If you put it into a batch file then
you must double the % characters.
I think that he means that the command returns a lot of File Not Found
error verbiage. Example:
C:\>dir /s /b "c:\Program Files\psexec.exe"
c:\Program Files\Sysinternals\PsTools\psexec.exe
one line only returned, where the file actually resides.
as opposed to:
C:\>for /d %a in ("c:\Program Files\s*.*") do dir /s /b "%a\psexec.exe"
C:\>dir /s /b "c:\Program Files\SBApps\psexec.exe"
File Not Found
C:\>dir /s /b "c:\Program Files\Smart Projects\psexec.exe"
File Not Found
C:\>dir /s /b "c:\Program Files\Sonic\psexec.exe"
File Not Found
C:\>dir /s /b "c:\Program Files\Spybot - Search & Destroy\psexec.exe"
File Not Found
C:\>dir /s /b "c:\Program Files\stunnel\psexec.exe"
File Not Found
C:\>dir /s /b "c:\Program Files\Support Tools\psexec.exe"
File Not Found
C:\>dir /s /b "c:\Program Files\Sysinternals\psexec.exe"
c:\Program Files\Sysinternals\PsTools\psexec.exe
C:\>dir /s /b "c:\Program Files\SystemTools\psexec.exe"
File Not Found
The later 'do echo dir' command that you suggest in your other post
doesn't work because it just recusively echoes the command against all
the s* directories, it doesn't actually find the file and to an
untrained eye it would suggest that the psexec file is in all the \s*
directories:
C:\>for /d %a in ("c:\Program Files\s*.*") do echo dir /s /b "%a\psexec.exe"
C:\>echo dir /s /b "c:\Program Files\SBApps\psexec.exe"
dir /s /b "c:\Program Files\SBApps\psexec.exe"
C:\>echo dir /s /b "c:\Program Files\Smart Projects\psexec.exe"
dir /s /b "c:\Program Files\Smart Projects\psexec.exe"
C:\>echo dir /s /b "c:\Program Files\Sonic\psexec.exe"
dir /s /b "c:\Program Files\Sonic\psexec.exe"
.... and so on.
John