0

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.

Erik
  • 1,329
  • 4
  • 21
  • 39
  • 1
    Have you tried executing the batch file using cmd.exe and the `start` command to execute the batch? I don't know that it will work but it is the first thing that I would try. Also, is the user `user` logged in?.. what do you expect to happen if they aren't? Should the logged in session remain? – Señor CMasMas Feb 15 '22 at 05:41

1 Answers1

0

Potentially just use nested batch files and use psexec to call a local batch on the remote machine? https://jpsoft.com/help/call.htm