I use a SSH client (bitvise SSH client) to connect to another Windows machine and launch a process. The processes take a long time to complete and I want to disconnect from the remote machine while keeping the process running. How can I do this? When I close the terminal or terminate the SSH session, the process is killed too.

This question has been asked and answered for Unix machines but I couldn't find anything for Windows.

  • 1
    Possible duplicate of Continue process after closing terminal? – Thomas Dickey Nov 10 '17 at 1:12
  • @ThomasDickey As stated in the question, I want a solution for Windows, not Linux (your link). – Luttinger Nov 10 '17 at 1:15
  • SSH on Windows? What’s wrong with powershell? – Appleoddity Nov 10 '17 at 1:31
  • @Appleoddity I'm not sure what do you mean. I use bitvise SSH client on my Windows machine to connect to another Windows machine and run a process. What does it have to do with powershell? Is there anything else I can do? – Luttinger Nov 10 '17 at 1:34
  • 2
    When you say you're ssh'ing onto a windows machine, this generates lots of questions -- are you using Linux On Windows subsystem, just running a sshd daemon and running commands in cmd, or what? – djsmiley2k Nov 10 '17 at 13:47

I contacted Bitvise support for a solution. Turns out Bitvise SSH server does have this functionality, as explained here, and I explain their answer:

First make sure that the setting "Allow session job breakaway" is enabled for the SSH login account. It is located in the "Advanced SSH Server settings", for the account or group settings entry, under "Terminal and exec requests". (It is by default enabled in recent Bitvise SSH Server versions)

Now we can run the process detached from the session using BvRun, located in the Bitvise installation directory (we should add it to the PATH so that we can run it everywhere)

BvRun -brj -new (insert full command here)

this runs the command in a new terminal window. Alternatively:

BvRun -brj -det (insert full command here)

this runs the command detached from the session. Note that in both cases you can't see the output in terminal window and should redirect the output to a file if you want.

Your Answer

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

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