你如何从 PHP 运行 .bat 文件? [英] How do you run a .bat file from PHP?
本文介绍了你如何从 PHP 运行 .bat 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能告诉我如何从 PHP 脚本执行 .bat 文件?
Can anyone tell me how to execute a .bat file from a PHP script?
我试过了:
exec("C:[path to file]");
system("C:[path to file]");
没有任何效果.我已经检查了 PHP 手册并用谷歌搜索,但找不到好的答案.有谁知道我哪里出错了?
Nothing is working. I've checked the PHP manuals and googled around but can't find a good answer. Anyone know where I'm going wrong?
我正在运行 Windows 2003 Server,并且已经成功地手动运行了 .bat 文件,它完成了我需要的工作;我只需要能够以编程方式启动它.
I'm running Windows 2003 Server and have successfully manually run the .bat file and it does what I need it to; I just need to be able to launch it programatically.
推荐答案
您可能需要通过 cmd
运行它,例如:
You might need to run it via cmd
, eg:
system("cmd /c C:[path to file]");
这篇关于你如何从 PHP 运行 .bat 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文