Question

Hi I am New to scripting . I have to remotely execute a PSEXEC command to delete al files in a certain drive in a few computers. I do have a TXT file with every ip address of all the computers. Is there a way to use PSEXEC to cmd command all the computers to delete the folders by executing every command for every IP in my txt file? currently i am using this line whereby i need to manually enter the ip address in the command line for eg . PsTools>PsExec.exe \ 1.1.1.1 , 1.1.1.2 cmd /c rmdir /S /Q D:\

Was it helpful?

Solution

FOR /F %%i IN (FileWithEveryIP.txt) DO PSEXEC \\%%i CMD /C DIR folderToDelete

Use %i instead of %%i if you run it from command prompt window instead of batch file.

Replace DIR with RMDIR /S /Q if it works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top