简体   繁体   English

从后台批处理文件在Windows上执行php脚本?

[英]execute a php script on windows from batch file in background?

I'm trying to run a php script from batch file, and I want to have it run in the background, so there will be no new PHP window, and also have the batch file window close immediately and not wait for the php script to end. 我正在尝试从批处理文件运行php脚本,并且我想让它在后台运行,因此将没有新的PHP窗口,并且也将立即关闭批处理文件窗口,而不是等待php脚本运行结束。 I've tried all of these: 我已经尝试了所有这些方法:

  1. start php.exe myscript.php - the batch file window close immediately, but a new php window opens and waits for the script to end start php.exe myscript.php批处理文件窗口立即关闭,但新的php窗口打开并等待脚本结束
  2. start \\B php.exe myscript.php - no php window opens, but the batch file window stays open until the php script ends. start \\B php.exe myscript.php没有打开php窗口,但是批处理文件窗口一直保持打开状态,直到php脚本结束。
  3. php.exe myscript.php - same behavior as with start php.exe myscript.phpstart相同的行为

Is there a way I can achieve both - no php window and close the batch file console immediately? 有没有一种方法我可以同时实现的-没有php窗口并立即关闭批处理文件控制台?

Try this: 尝试这个:

start /min myscript.php

let me know if it works for you. 请让我知道这对你有没有用。

Also you could have a look at this: 你也可以看看这个:

http://www.ntwind.com/software/hstart.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM