How to run a command in the background on Windows?

前端 未结 4 1760
故里飘歌
故里飘歌 2020-12-01 17:49

In linux you can use command & to run command on the background, the same will continue after the shell is offline. I was wondering is there so

4条回答
  •  春和景丽
    2020-12-01 18:25

    Use the start command with the /b flag to run a command/application without opening a new window. For example, this runs dotnet run in the background:

    start /b dotnet run
    

    You can pass parameters to the command/application too. For example, I'm starting 3 instances of this C# project, with parameter values of x, y, and z:

    To stop the program(s) running in the background: CTRL + BREAK

    In my experience, this stops all of the background commands/programs you have started in that cmd instance.

    According to the Microsoft docs:

    CTRL+C handling is ignored unless the application enables CTRL+C processing. Use CTRL+BREAK to interrupt the application.

提交回复
热议问题