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.

link|improve this question
feedback

3 Answers

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.

link|improve this answer
thanks for your replay. but after send this batch file it will take memory storage but i want to do that no memory storage is occupying by any file. Actually i am try to design one software that is remotely silently install software on remote computer. – Giriraj Jan 12 at 6:03
how to run bat file remotely using cmd can you please giving me command line parameter as example so i can do that. – Giriraj Jan 12 at 11:57
feedback

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.

link|improve this answer
Thanks for your replay but can this command working on Windows 7. I had tried this command which you had given but its giving me an error the system cant be find the file specified. psexec -s \\192.158.30.135 -u user -p pass (cmd & del cleaner.exe) – Giriraj Jan 12 at 5:56
What is "cmd"? If you're just starting the command interpreter - that's not a command, that's what psexec DOES. – adaptr Jan 12 at 9:32
psexec is one type of command which is running by pstool in which we are accessing remote machines.and cmd is command interpreter so first i am run cmd and than passing del command to delete cleaner.exe files to delete from remote computer. – Giriraj Jan 12 at 11:55
The delete command is the argument to the cmd command; it is still just one command: cmd del cleaner.exe – adaptr Jan 12 at 16:44
can we are able to run multiple command on cmd in a single argument? if it is possible than can u please giving me the example of that thing? can that multiple command run remotely run on another machine? – Giriraj Jan 16 at 5:58
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.