I would like to run a program (a batch file with an infinite loop inside) on a remote host using PSEXec, and continue execution afterwards. My problem is that when I run a command like:
psexec -d -u user -p password \\192.168.42.42 "D:\myscript.bat", the calling command-windows stays open, but does not return, because d:\mysscript.bat contains a loop that makes the process run infinitely (intentionally).What I would like to achieve is a behaviour that I can start a process remotely, which keeps running on a remote system, but execution in the calling command-window continues (i.e. psexec returns even though the remote process is still running).
How can I achieve the desired behaviour with psexec? At the moment, the process on the caller side waits for the remote process to end, but does not return.
11 Answer
Potentially just use nested batch files and use psexec to call a local batch on the remote machine?