E
Eric Caron
Hi all,
I'm trying to automate some tasks on a server in our intranet by using a web
application. I already have a batch script that registers a DLL passed as a
parameter on the command line. I'd like to be able to first copy a file
from a shared location to the root of the c:\ drive, then call my batch file
with the file as a parameter. I found the Shell function that seemed to do
what I want and did a quick and dirty web form with a textbox and a button
with the following code on the on_click handler of the button:
strCommandLine = "copy E:\Data\" & Me.txtCommand.Text & " c:\"
Response.Write("<p>" & strCommandLine & "</p>" & vbCrLf)
Shell("copy E:\Data\" & Me.txtCommand.Text & " c:\", AppWinStyle.Hide, True)
strCommandLine = "update.bat " & Me.txtCommand.Text
Response.Write("<p>" & strCommandLine & "</p>" & vbCrLf)
Shell("update.bat " & Me.txtCommand.Text)
However, I get the following error when the Shell command is executed:
File not found.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: File not found.
I'm sure of the path and the file is there. I'm wondering if it's a
permission problem and the error message is misleading me.
Any example of a similar task?
I'm trying to automate some tasks on a server in our intranet by using a web
application. I already have a batch script that registers a DLL passed as a
parameter on the command line. I'd like to be able to first copy a file
from a shared location to the root of the c:\ drive, then call my batch file
with the file as a parameter. I found the Shell function that seemed to do
what I want and did a quick and dirty web form with a textbox and a button
with the following code on the on_click handler of the button:
strCommandLine = "copy E:\Data\" & Me.txtCommand.Text & " c:\"
Response.Write("<p>" & strCommandLine & "</p>" & vbCrLf)
Shell("copy E:\Data\" & Me.txtCommand.Text & " c:\", AppWinStyle.Hide, True)
strCommandLine = "update.bat " & Me.txtCommand.Text
Response.Write("<p>" & strCommandLine & "</p>" & vbCrLf)
Shell("update.bat " & Me.txtCommand.Text)
However, I get the following error when the Shell command is executed:
File not found.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: File not found.
I'm sure of the path and the file is there. I'm wondering if it's a
permission problem and the error message is misleading me.
Any example of a similar task?