Remove remote directory using RD command.
I recently found out that the old MS-DOS command RD (Remove Dir) is also working on remote machines.
Just the easy command RD /s “computerC$temp” does the trick.Now if you need to delete the same directory on a whole bunch of machines make a little for loop and cross fingers you have the correct directory.Little example including a ping:
=================================================================== FOR /F %%s IN (server.txt) DO (set Srvr=%%s&Call:ping) :ping ping -n 1 %Srvr%| find "TTL" if errorlevel 1 goto Noresponse rd /s /q %Srvr%c$tempinstall goto error :Noresponse echo %Srvr% Unreachable echo %Srvr% Unreachable >>error.log goto done :error if %ErrorLevel%==0 goto label0 goto done :label0 echo %Srvr% %ErrorLevel% Success The operation completed succesfully>>error.log goto done :done ===================================================================