你如何从PHP .bat文件? [英] How do you run a .bat file from PHP?

查看:193
本文介绍了你如何从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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆