我正在尝试从服务器 (IIS-6) 上的 ASP 文件中运行 VBS 文件VBS 文件存放的地方)。
所以,我有一个如下所示的 default.asp 页面:
<%response.write "hello" 'just for debugging purposes.
set objshell = server.createobject("wscript.shell")
objShell.Run "c:\test\test.vbs",0,true '0=no interaction, true=wait for command to finish%>
VBS 文件只是一个空文件(一些备注)所以应该发生的是 wscript 应该运行,什么都不做,关闭 wscript.exe 并返回它已完成。
上例中发生的情况是服务器上 wscript.exe 启动,网页等待命令完成。但是 wscript.exe 永远不会自行退出/停止。如果我结束 wscript.exe 进程,则页面将继续加载。但是 VBS 不会被执行。
所以我尝试了一些修改,我在 VBS 文件中添加了代码来编写一个带有执行时间的文件,所以我知道它不会运行 VBS 文件。
我还尝试了 objshell.run/exec 命令的其他变体:
objsshell.exec("cscript.exe /B /H:Cscript c:\test\test.vbs") ' nothing happens at all.
objsshell.exec("wscript.exe /B /H:Cscript c:\test\test.vbs") ' wscript and "hangs"
有人对我如何让 VBS 命令运行和 Wscript.exe 进程退出有任何提示吗?