运行批处理文件 [英] running a batch file
问题描述
我需要从ASP页面在远程计算机上运行批处理文件。我在测试ASP页面上打了个d
如下:
<%
设置WshShell = Server.CreateObject(" Wscript.Shell")
wshshell.run" c:\inetpub \wwwroot \ logasp \ getdr.bat> c:\tstlog.txt"
%>
批处理文件如下:
set> c :\ env.txt
目录c:\ *。*
在我的本地机器上运行正常,生成env.txt和tstlog.txt
个文件。当我把它放在另一台机器上时,目录和环境
命令不能运行。我得到的是:
C:\ WINDOWS \system32>设置1> c:\ env.txt
C:\ WINDOWS \\ \\ system32> dir c:\ *。*
的回复。我已经尝试过在TechED的Microsoft SME上按照建议将身份验证设置为BASIC,但无济于事。为什么它不起作用?
最后,我需要能够让ASP页面调用一个批处理文件来
更改文件上的ACLS一台远程机器。
任何帮助都将不胜感激。
I need to run a batch file on a remote machine from an ASP page. I dummied
up a test ASP page as follows:
<%
Set WshShell = Server.CreateObject("Wscript.Shell")
wshshell.run "c:\inetpub\wwwroot\logasp\getdr.bat > c:\tstlog.txt"
%>
the batch file is as follows:
set >c:\env.txt
dir c:\*.*
On my local machine, it runs fine, generating the env.txt and tstlog.txt
files. When I put it on another machine, the directory and environment
commands don''t run. All I get is:
C:\WINDOWS\system32>set 1>c:\env.txt
C:\WINDOWS\system32>dir c:\*.*
for a response. I''ve tried setting the authentication to BASIC as suggested
by a Microsoft SME at TechED but to no avail. Why does it not work?
In the end, I need to be able to have the ASP page call a batch file to
change ACLS on files on a remote machine.
Any help would be appreciated.
推荐答案
=?Utf-8?B?RG91ZyBhdCBTQVU =?=于2005年6月20日写在
microsoft.public.inetserver.asp.general:
=?Utf-8?B?RG91ZyBhdCBTQVU=?= wrote on 20 jun 2005 in
microsoft.public.inetserver.asp.general:
I需要从ASP页面在远程计算机上运行批处理文件。我打了一个测试ASP页面如下:
<%
设置WshShell = Server.CreateObject(" Wscript.Shell")
wshshell.run " c:\inetpub\wwwroot\logasp\getdr.bat> c:\tstlog.txt"
%>
I need to run a batch file on a remote machine from an ASP page. I
dummied up a test ASP page as follows:
<%
Set WshShell = Server.CreateObject("Wscript.Shell")
wshshell.run "c:\inetpub\wwwroot\logasp\getdr.bat > c:\tstlog.txt"
%>
ASP在服务器上运行,而不是在遥控器上运行,
如果你的意思是通过远程机器浏览器运行。
-
Evertjan。
荷兰。
(用我的电子邮件地址替换所有带点的十字架)
ASP runs on the server, not on a remote,
if you mean by remote the machine the browser runs on.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
澄清:
我我想从服务器上的asp页面运行一个脚本与另一台机器上的另一台机器。
当我在工作站上运行所有内容时,它运行正常。当我将
代码移动到另一台机器并登录时,它无法正常工作。
示例ASP页面没有返回任何内容,只有一个空白页面。我必须
去服务器看看批处理文件是否在那台机器上运行。
Evertjan。写道:
for clarification:
I am wanting to run a script from an asp page on a server against another
machine.
When I ran everything on my workstation, it worked fine. When I moved the
code to another machine and logged in, it didn''t work.
The sample ASP page doesn''t return anything, only a blank page. I have to
go to the server to see if the batch file ran on that machine.
"Evertjan." wrote:
=?Utf-8?B?RG91ZyBhdCBTQVU =?=于2005年6月20日写在
microsoft.public.inetserver.asp.general:
=?Utf-8?B?RG91ZyBhdCBTQVU=?= wrote on 20 jun 2005 in
microsoft.public.inetserver.asp.general:
我需要从ASP页面在远程机器上运行批处理文件。我打了一个测试ASP页面如下:
<%
设置WshShell = Server.CreateObject(" Wscript.Shell")
wshshell.run " c:\inetpub\wwwroot\logasp\getdr.bat> c:\tstlog.txt"
%>
I need to run a batch file on a remote machine from an ASP page. I
dummied up a test ASP page as follows:
<%
Set WshShell = Server.CreateObject("Wscript.Shell")
wshshell.run "c:\inetpub\wwwroot\logasp\getdr.bat > c:\tstlog.txt"
%>
ASP在服务器上运行,而不是在远程运行,
如果你的意思是远程机器浏览器继续运行。
-
Evertjan。
荷兰。
(用我的电子邮件地址替换所有带点的十字架)
ASP runs on the server, not on a remote,
if you mean by remote the machine the browser runs on.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
=?Utf-8?B?RG91ZyBAIFNBVQ ==?=于2005年6月20日写在
microsoft.public.inetserver.asp.general :
=?Utf-8?B?RG91ZyBAIFNBVQ==?= wrote on 20 jun 2005 in
microsoft.public.inetserver.asp.general:
Evertjan。写道:
"Evertjan." wrote:
=?Utf-8?B?RG91ZyBhdCBTQVU =?=于2005年6月20日写在
microsoft.public.inetserver.asp.general:
=?Utf-8?B?RG91ZyBhdCBTQVU=?= wrote on 20 jun 2005 in
microsoft.public.inetserver.asp.general:
>我需要从ASP页面在远程计算机上运行批处理文件。我
>打了一个测试ASP页面如下:
>
> <%
>设置WshShell = Server.CreateObject(" Wscript.Shell")
> wshshell.run" c:\inetpub \ www.root \logasp \ getdr.bat> c:\tstlog.txt"
> %>
>
ASP在服务器上运行,而不是在远程服务器上运行,
如果你的意思是远程浏览器运行的机器。
> I need to run a batch file on a remote machine from an ASP page. I
> dummied up a test ASP page as follows:
>
> <%
> Set WshShell = Server.CreateObject("Wscript.Shell")
> wshshell.run "c:\inetpub\wwwroot\logasp\getdr.bat > c:\tstlog.txt"
> %>
>
ASP runs on the server, not on a remote,
if you mean by remote the machine the browser runs on.
[请不要在usenet上使用]
澄清:
我想从一个asp页面运行一个脚本服务器对另一台机器。
所以你想在远程服务器上运行asp文件并晒太阳壳
那里?
当我运行一切时在我的工作站上,它工作正常。当我将代码移动到另一台机器并登录时,它无法正常工作。
示例ASP页面不返回任何内容,只返回空白页面。我必须去服务器查看该批处理文件是否在该机器上运行。
[please do not toppost on usenet]
for clarification:
I am wanting to run a script from an asp page on a server against
another machine.
So you want to run the asp file on a distant server and sun the shell
there?
When I ran everything on my workstation, it worked fine. When I moved
the code to another machine and logged in, it didn''t work.
The sample ASP page doesn''t return anything, only a blank page. I
have to go to the server to see if the batch file ran on that machine.
我认为这必须是一个权利问题。
默认情况下,运行ASP的过程权限非常有限。
但是如果生成一个空白文件,批处理必须已经运行,你可以
通过使用
Scripting.FileSystemObject运行另一个asp文件,从远程检查tstlog.txt文件。如果由于
权限不足而无法访问c:\ tstlog.txt,那么shell命令可能会有相同的
问题。 [除了可能的只读权利]
-
Evertjan。
荷兰。
(在我的电子邮件地址中用点替换所有十字架)
I think that must be a rights issue.
The process that runs ASP has very limited rights by default.
However if a blank file is made the batch must have run and you could
inspect the tstlog.txt file from remote by running another asp file with
Scripting.FileSystemObject. If you cannot reach c:\tstlog.txt because of
insufficient rights, the shell command would probably have the same
problem. [except for a possible read-only right]
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
这篇关于运行批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!