Executing a .bat file from ASP.Net VB

J

JohnP

I am trying to execute a .bat file with the following code:

Dim objProcess As Diagnostics.Process
Dim objProcessInfo As Diagnostics.ProcessStartInfo

objProcess = New Diagnostics.Process()
objProcessInfo = New Diagnostics.ProcessStartInfo(Server.MapPath("COFile.bat"))

objProcess.StartInfo = objProcessInfo
objProcess.EnableRaisingEvents = True
objProcess.Start()
objProcess.WaitForExit()

It doesn't seem to be doing anything. Am I doing something wrong with the code?

Thanks.

John
 
H

Hans Kesting

I am trying to execute a .bat file with the following code:
Dim objProcess As Diagnostics.Process
Dim objProcessInfo As Diagnostics.ProcessStartInfo
objProcess = New Diagnostics.Process()
objProcessInfo = New
Diagnostics.ProcessStartInfo(Server.MapPath("COFile.bat"))
objProcess.StartInfo = objProcessInfo
objProcess.EnableRaisingEvents = True
objProcess.Start()
objProcess.WaitForExit()
It doesn't seem to be doing anything. Am I doing something wrong with
the code?

Thanks.

John

Where do you expect that batch file to be executed? How do you
expect to see the results?
That batch file will run on the server, probably using the
"NETWORK SERVICE" account. Any output will not be show to the
user accessing the page that fired this command.

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top