批处理文件执行ASP经典 [英] batch file execution asp classic
问题描述
我需要帮助,从客户端执行批处理文件(通过HTTP内联网使用ASP经典执行访问)。
I need help executing a batch file from a client (accessing via HTTP intranet executing using ASP Classic).
OS中使用:
- 客户端(Windows XP中) - 这里是用户将访问HTML页面 。
- 服务器(Windows Server 2003) - 这里是正在创建所在的文件夹,包括批处理文件。这也是ASP页和HTML页被存储并通过IIS运行
情景:
用户将访问链接到一个asp页面的HTML页面....
The user will access an HTML page that is linked to an asp page....
HTML code:
HTML code:
<html>
<body>
<form method="GET" action="default.asp">
Name<input type="text" name="firstname"/>
Uname<input type="text" name="username"/>
Fulname<input type="text" name="fullname"/>
Pass<input type="text" name="password"/>
Qwarning<input type="text" name="qwarning"/>
Qlimit<input type="text" name="qlimit"/>
<input id="submit" type="submit" value= "submit" />
</form>
</body>
</html>
填写表格下面的ASP codeS将执行后。结果
-The以下code将创建一个文件夹,并创建一个批处理文件,将创建一个用户帐户,并设置其帐户权限
After filling the forms the following asp codes will execute.
-The following code will create a folder and create a batch file that will create a user account and set its account permission
ASP code:
<%
'Folder Creation
dim fs
Dim name,uname,fulname,pass,qlimit,qwarning
name = Request.QueryString("firstname")
uname = Request.QueryString("username")
fulname = Request.QueryString("fullname")
pass = Request.QueryString("password")
qlimit = Request.QueryString("qlimit")
qwarning = Request.QueryString("qwarning")
'Batch File Creation
set fs=Server.CreateObject("Scripting.FileSystemObject")
if NOT fs.FolderExists("c:\dept\" & name ) Then
fs.Createfolder("c:\dept\" & name)
response.write name &" successfully created"
else
response.write name &" is already exist!"
end if
set fs=nothing
dim fsc,cfile
set fsc=Server.CreateObject("Scripting.FileSystemObject")
set cfile=fsc.CreateTextFile("c:\dept\" & name & ".bat")
'User Creation
cfile.writeline("echo off")
cfile.writeline("cd\")
cfile.writeline("Net User " & uname & " " & pass & " /add /comment:""Created by Mystic System"" /expires:never /fullname:""" & fulname & """ /passwordchg:no")
cfile.writeline("WMIC USERACCOUNT WHERE ""Name='" & uname & "'"" SET PasswordExpires=False")
'USER QUOTA
cfile.writeline("fsutil quota modify c: 104857600 209715200 WINDOWS-GDKLDNY\" & uname)
'Creation OF Permision to folder
cfile.WriteLine("cacls c:\dept\" & name & " /e /P Administrator:F")
cfile.WriteLine("cacls c:\dept\" & name & " /e /P " & uname & ":R")
cfile.WriteLine("cacls c:\dept\" & name & " /e /G " & uname & ":W")
cfile.WriteLine("del /a " & "c:\dept\" & name & ".bat")
cfile.close
set cfile=nothing
set fsc=nothing
set perm=nothing
set wshell = CreateObject("WScript.Shell")
wshell.run "c:\dept\" & name & ".bat"
set wshell = nothing
%>
错误:
已显示任何错误。
- 我已经授予IUSR,IWAM,IIS_WPG包括网络服务完全权限的根文件夹因绝望.. :(
-I have already grant the IUSR,IWAM,IIS_WPG including the NETWORK SERVICE full permission to the root folder due to desperation.. :(
问题:结果
批处理文件不执行或者没有被读取(其像批处理文件是不开放执行其内容)。如果我手动运行,或打在批处理文件输入它完美运行。似乎是什么问题?是在我的ASP?
Problem:
The batch file is not executing or maybe not being read (its like the batch file is not opening to execute its content). If i run it manually or hit enter on the batch file it runs perfectly. What seems to be the problem? is it on my ASP?
-I've已经监视的过程或该文件被客户端使用的Filemon应用程序访问的,其结果是从w3wp.exe的和cmd.exe的所有的成功。
-I've尝试创建一个VBScript来执行批次和VBScript的正在由ASP调用。结果
仍然没有运气。 (
-I've already monitored the process or the file being accessed by the client using "Filemon" application and the results are all success from the w3wp.exe and cmd.exe.
-I've tried creating a vbscript to execute that batch and the vbscript is being called by the asp.
Still no luck. :(
推荐答案
从我的经验WSCRIPT.SHELL只有真正与IIS 5的工作,我可能会建议另一种方式来执行批处理文件:
From my experience WScript.Shell only really worked with IIS 5, might I suggest another way to execute the batch file:
如果您可以访问SQL:
If you have access to SQL:
如果你可以注册一个COM:
If you can register a COM:
HTTP:// WWW .shotdev.com / ASP / ASP-运行执行-EXE / ASP-执行-EXE-W脚本壳/
来源:
<一href=\"http://stackoverflow.com/questions/14532048/trying-to-launch-photoshop-with-scripting/14555053#14555053\">Trying与脚本启动Photoshop
Source: Trying to launch photoshop with scripting
这篇关于批处理文件执行ASP经典的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!