I am trying to run a VBS file from within an ASP file on a server (IIS-6)
I have changed the security so one have to login to the server to access the ASP-page (this so that ASP is given permission to the place where the VBS files are stored).
So, I have a default.asp page that looks like this:
<%response.write "hello" 'just for debugging purposes.
set objshell = server.createobject("wscript.shell")
objShell.Run "c:estest.vbs",0,true '0=no interaction, true=wait for command to finish%>
The VBS file is just an empty file (some remarks) so what SHOULD happen, is the wscript should run, do nothing, close wscript.exe and return that it is done.
What happens in the above example is that on the server wscript.exe starts, and the webpage waits for the command to finish. But the wscript.exe never quits/stops by itself. If I end the wscript.exe process then the page will continue loading. But the VBS will not have been executed.
So I have tried a few modifications, I added code to the VBS file to write a file with the time of the execution, so I KNOW that it does not run the VBS file.
I have also tried other variants of the objshell.run/exec commands:
objsshell.exec("cscript.exe /B /H:Cscript c:estest.vbs") ' nothing happens at all.
objsshell.exec("wscript.exe /B /H:Cscript c:estest.vbs") ' wscript and "hangs"
Anyone have any tips on how I get the VBS command to run, and the Wscript.exe process to exit?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…