Press "Enter" to skip to content

让windows命令在后台执行

在执行的命令前加上start /b,比如start /b run.bat。就相当于Linux下的run.sh &。

function execInBackground($cmd) {
if (
substr(php_uname(), 0, 7) == “Windows”){
pclose(popen(“start /B “. $cmd, “r”));
}
else {
exec($cmd . ” > /dev/null &”);
}
}

 

发表评论