简体   繁体   English

从运行php的IIS服务器执行vbscript或批处理文件

[英]Execute vbscript or batch file from IIS server running php

I am not sure if this possible but I have been able to execute shell commands so it leads me to belive it is, but I cannot run any .vbs or .bat scripts using the same method below. 我不确定是否可以这样做,但是我已经能够执行shell命令,因此使我不敢相信,但是我无法使用下面的相同方法运行任何.vbs或.bat脚本。 The command below works and I can see the results but anything further the server just hangs and timeouts. 下面的命令有效,我可以看到结果,但是服务器挂起并超时的任何其他操作。 Side note - ActiveX works but is disabled on my phone, Chrome, and Firefox so this solution will need to work with a Safari browser 旁注-ActiveX可以使用,但在我的手机,Chrome和Firefox上已被禁用,因此此解决方案需要与Safari浏览器一起使用

works 作品

echo shell_exec("dir");

fails (I have even tried adding "&" to run the command in the background) 失败(我什至尝试添加“&”在后台运行命令)

echo shell_exec("full path to script");

Background: I have a HTPC that I have connected to a monitor for regular use and connected to a big screen tv in my room. 背景:我有一台HTPC,我已将其连接到显示器以进行常规使用,并已连接至房间中的大屏幕电视。 I have written a vbs to handle switching displays from monitor to tv and vice versa and also setting audio to tv instead of internal speakers and vice versa. 我写了一个vb来处理从显示器到电视的切换显示,反之亦然,还设置音频到电视而不是内部扬声器,反之亦然。 This is an eloquent solution and saves me time from the minor annoyance of changing the setting, but I would like to take this a step further and have a server hosting these files so I can connect locally and change these settings (ideally while laying in bed and/or to show off some automation) 这是一种雄辩的解决方案,可以节省更改设置的烦恼,但我想进一步,并让服务器托管这些文件,以便我可以在本地连接并更改这些设置(最好躺在床上)和/或炫耀一些自动化)

I have tried just about everything so any useful suggestions are encouraged. 我已经尝试了几乎所有内容,因此鼓励任何有用的建议。 I anticipate its a small configuration or permission or path that is causing the time out. 我预计它的配置太小或权限太小,导致超时。 I do have my scripts hosted within the same directory as my index.php file (wwwroot/) and I have tried calling the file numerous ways. 我的脚本确实与index.php文件(wwwroot /)托管在同一目录中,并且我尝试过以多种方式调用该文件。

Thanks in advance for any help. 在此先感谢您的帮助。

Dir is an internal command to command.com and cmd.exe. Dir是command.com和cmd.exe的内部命令。 Therefore they need to execute it. 因此,他们需要执行它。 cmd /k dir . cmd /k dir

See cmd /? 看到cmd /? for more. 更多。

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

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