FOR Statement

  • Thread starter Thread starter Barney
  • Start date Start date
B

Barney

Why isn't the following working? The DIR command works
interactively. Is there a reserved shell character that
I'm failing to escape?


SET /P ComputerName=Enter the name of the computer that
you want to clean up:^\^>

FOR %%X IN ('"DIR \\%ComputerName%
\C$\WINNT\$NTUninstall* /A:H /B /S"') DO RD /S /Q %%X
 
Barney said:
Why isn't the following working? The DIR command works
interactively. Is there a reserved shell character that
I'm failing to escape?


SET /P ComputerName=Enter the name of the computer that
you want to clean up:^\^>

FOR %%X IN ('"DIR \\%ComputerName%
\C$\WINNT\$NTUninstall* /A:H /B /S"') DO RD /S /Q %%X

set /p which_computer="Enter the name of the computer that you want to clean up: >"
if not defined which_computer set which_computer=%computername%
for /f "tokens=*" %%X in ('dir /AD /B /S "\\%which_computer%\c$\winnt\$NTUninstall*"') do echo rd /s /q "%%X"
 
Back
Top