6

I am try to use multiple command with psexec tools but i am only remotely entered in that computer but it won't be perform another command

psexec -i \\192.168.30.135 -u username -p password cmd & del abc.exe

by using this command line parameter i am able to only entered in that machine remotely but it can't perform an del command to delete that file can any one having solution about this please give me.

Bart De Vos
  • 18,171
Giriraj
  • 61

3 Answers3

5

If you have access to the remote machine (which I assume you do since you can run PSEXEC) you can copy a batch file to the remote system first, then use psexec to run the batch file.

3

The command following the first one is a new command; the first command was psexec followed by something, not something on its own.

Make it one compound command:

psexec -i \192.158.30.135 -u username -p password (cmd1 & cmd2)

Read http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_o.mspx?mfr=true for more info.

adaptr
  • 16,746
2

I believe you will find the second command is running on the local machine, not the remote one. You need to use quote marks like this:

psexec \\servername cmd /c "dir"

I used it and this is working fine.