Search code examples
windowscommand-linecygwin

Running command in background using cygwin from Windows cmd


I use cygwin from my Windows command line, I've always done everything quite happily except being able to run something in the background (i.e. putting & at the end of a command).

Just to give you more context, I want to be able to start a Mercurial web server and still be able to keep using the command line window and even closing it without killing the server. For example:

>hg serve &
listening at http://localhost:8000/ (bound to *:8000)
>echo "Still able to do this"

Any workarounds to this?


Solution

  • Found the solution:

    start <command> /B
    

    start is a windows command, do a help start for more info

    Alternatively and for my case

    hg serve --daemon
    

    or

    hg serve -d
    

    will do the trick