Windows – Executing a batch file in a remote machine through PsExec


I am trying to run a batch file (in the batch file I have just written 'notepad') on a remote PC through PSExec. The psexec command below runs in my laptop but fails to do anything on the remote PC. I don't even see 'notepad' running on the list of processes in the remote machine.

c:\Program Files (x86)\PSTools>psexec -u administrator -p force \\ -s -d cmd.exe /c -c "C:\Amtra\bogus.bat"

PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals -

cmd.exe started on with process ID 1520.

Anyone can help me where I am going wrong here?


Best Answer

You have an extra -c you need to get rid of:

psexec -u administrator -p force \\ -s -d cmd.exe /c "C:\Amitra\bogus.bat"