如何从传统的ASP页面在服务器上执行一个bat文件 [英] How to execute a bat file from a classic asp page on the server

查看:440
本文介绍了如何从传统的ASP页面在服务器上执行一个bat文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有执行时运行一个访问宏简单的bat文件,我需要知道如何从一个ASP页面执行这个bat文件,我已经给所有的权限IUSR_MACHINENAME包含脚本文件的特定文件夹, ASP文件。

I have a simple bat file that runs an access macro when executed, i need to know how to execute this bat file from a asp page, i have given all the permissions to the iusr_machinename for that particular folder containing the script file and the asp file.

感谢您

请注意:我不希望运行的客户端系统上的任何东西,我只是想运行ASP应用程序运行在同一系统上一个bat文件

Note: I don't want to run anything on the client system, i just want to run a bat file on the same system the asp application is running

推荐答案

假设你明白这样做的安全问题,在code是简单:

Assuming you understand the security implications of doing this, the code is as simple as:

set wshell = CreateObject("WScript.Shell") 
wshell.run "c:\path\to\file.bat" 
set wshell = nothing

我只是跑这对一个虚拟实例而不给予任何特殊权限IUSR_ *和它运行了一个XCOPY没有错误或干扰。

I just ran this on a virtual instance without giving any special permissions to IUSR_* and it ran an xcopy without error or interference.

您将面临的另一个问题是,当你的BAT文件引发提示或想要打开某种形式的对话的。这真的很难处理输出,这样的剧本在看进一步的问题之前,请确保您的BAT文件运行没有错误。

Another issue you will face is when your BAT file throws a prompt or wants to open some kind of dialog. It's really difficult to handle output, so make sure your BAT file runs without error before looking at further issues with the script.

这是否code在您的环境是你的安全设置问题。

Whether this code works in your environment is a matter of your security settings.

这篇关于如何从传统的ASP页面在服务器上执行一个bat文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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