Run Batch File on Remote Computer Using Psexec and Continue Execution, Don't Wait for Remote Process to End

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.

1

1 Answer

Potentially just use nested batch files and use psexec to call a local batch on the remote machine?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest