Running a command in the background using cygwin from Windows cmd

I use cygwin from my Windows command line, I always did everything quite happily, except for the ability to run something in the background (i.e. put &at the end of the command).

To give you more context, I want to be able to start the Mercurial web server and still be able to use the command line window and even close it without killing the server. For instance:

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

Any workarounds to this?

+3
source share
3 answers

Found a solution:

start <command> /B

startis a windows command, run help startfor more information

Alternatively and for my case

hg serve --daemon

or

hg serve -d

will do the trick

+1

Apache, cygstart, CMD start:

cygstart --hide /c/apache/bin/httpd.exe

Apache --hide

+5

'start' - internal cmd.exe command

You will need to use

cmd / c start COMMAND

0
source

All Articles