Thanks for your suggestion. That link showed me a glimpse of the expected answer. But, when i ran that code, nothing happened in the browser. I provided a response.write and that got displayed. The batch file i wanted to run didnt run at all. Infact, i provided all permissions to the IUSER_ account in the folder where i ran the batch file. Also, IIS has been configured to execute scripts and executables.
function Run (command)
dim oShell, oFileSystem, strTempFile, strCommand
set oFileSystem = CreateObject("Scripting.FileSystemObject"
if (Err.Number) then
Run = "Error creating object Scripting.FileSystemObject - " & Err.Number & " - " & Err.Description
exit function
end if
strTempFile = oFileSystem.GetSpecialFolder(2) & "\" & oFileSystem.GetTempName()
set oShell = CreateObject("WScript.Shell"
if (Err.Number) then
Run = "Error creating object WScript.Shell - " & Err.Number & " - " & Err.Description
exit function
end if
strCommand = "CMD /C """ & command & " 1> " & strTempFile & " 2>&1"""
call oShell.Run(strCommand, 1, true)
if (oFileSystem.FileExists(strTempFile)) then
dim oFile
set oFile = oFileSystem.GetFile(strTempFile)
if (oFile.Size) then
dim oText
set oText = oFileSystem.OpenTextFile(strTempFile, 1, false)
Run = oText.ReadAll
oText.Close
set oText = nothing
else
Run = "Failed to redirect command output."
end if
set oFile = nothing
else
Run = "Failed to redirect command output."
end if
set oFileSystem = nothing
set oShell = nothing
end function
%>
It's in its own folder and run as an administrator(Change IIS)
Executing Applications on a Server Through an ASP Page
Example: Getting Latest Versions From VSS [Micorsoft Visual Source Safe] by Neema Moraveji - 7/21/1999
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.