经典ASP-从Localhost上的网页运行.exe [英] Classic ASP - Running .exe from a Web Page on Localhost

查看:106
本文介绍了经典ASP-从Localhost上的网页运行.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行.bat以使用以下代码在本地主机(服务器端)上启动notepad.exe:

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

index.asp

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

当我打开ASP页面时,什么也没有发生.由于变量"return"而返回值0.因此,我尝试将 false 的值设置为 true ,然后服务器冻结,并且未返回任何内容.我认为发生这种情况是因为.bat文件没有返回任何值. 我尝试过也直接运行notepad.exe( C:\ Windows \ notepad.exe ),而不是使用.bat文件,但是仍然没有任何反应.我也尝试使用ASPExec.dll,但也无济于事.

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 ASPExec.dll but to no avail either.

有人知道我在做什么错吗?

Does anyone know what I am doing wrong?

更多信息:

我的本​​地Web服务器是Windows 7附带的IIS7.我在localhost上执行此操作只是出于测试目的.我必须在Classic ASP中完成此操作,因为最终我将不得不将网站导入WinCE7设备.我知道WshShell不适用于WinCE,但现在我只是想看看它是否有效.最终,我将需要能够运行一个.exe来通过网站在设备上安装更新.

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.

推荐答案

您的代码以非交互式IIS用户身份运行;它无法与本地桌面进行交互.

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

这篇关于经典ASP-从Localhost上的网页运行.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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