开发者

Classic ASP - Running .exe from a Web Page on Localhost

I am trying to execute a .bat to launch notepad.exe on my localhost(server-side) with the following code:

index.asp

<%
set wshell = CreateObject("WScript.Shell") 
return = wshell.run("c:\file.bat", 4, false)
response.write(return)
set wshell = nothing 
%>

file.bat

notepad.exe

When I open the ASP page, nothing happens. A value 0 is returned because of the variable "return". So I tried set the false value to be true, and then the server froze and didn't return anything; I think that happened because there were no values to be returned from the .bat file. I tried also running the notepad.exe (C:\Windows\notepad.exe) directly instead of using a .bat file but still nothing happened. I also tried using ASPE开发者_如何学Cxec.dll but to no avail either.

Does anyone know what I am doing wrong?

More info:

My local web server is IIS7 that comes with Windows 7. I am doing this on localhost just for testing purposes. I have to accomplish this in Classic ASP because eventually I will have to import the website to a WinCE7 device. I am aware that WshShell is not available for WinCE but for now I am just trying to see if it works. Eventually I will need to be able to run a .exe that installs updates on the device through the website.


Your code is running as a non-interactive IIS user; it cannot interact with the local desktop.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜