bat 后台运行命令
在 Linux 和 macOS 系统中,可以使用以下命令将程序在后台运行:
nohup command > /dev/null 2>&1 &
其中,command 为要在后台运行的命令,nohup 命令可以让程序在后台运行,并且不会受到用户退出登录或关闭终端的影响。/dev/null 是一个特殊的文件,用于丢弃输出,2>&1 表示将标准错误输出重定向到标准输出,& 表示将命令放入后台运行。
例如,要将一个名为 server.py 的 Python 程序在后台运行,可以使用以下命令:
nohup python server.py > /dev/null 2>&1 &
在 Windows 系统中,可以使用以下命令将程序在后台运行:
start /b command
其中,command 为要在后台运行的命令,start 命令可以让程序在后台运行,/b 表示不显示新窗口。
例如,要将一个名为 server.py 的 Python 程序在后台运行,可以使用以下命令:
start /b python server.py
``
原文地址: https://www.cveoy.top/t/topic/eCNU 著作权归作者所有。请勿转载和采集!