Use process class to run batch file in web server

G

Guest

I use the following code to run a batch file on the server side but it not working. The code is working fine on a c# window console program. Can anyone help me?

Process myProcess = new Process()
myProcess.StartInfo.FileName = "C:\\mapDrv.bat"
myProcess.StartInfo.CreateNoWindow = true
myProcess.Start();
 
E

Eric Lawrence [MSFT]

It's very unlikely that the ASPNET worker progress has execute permissions
on that batch file. Are you impersonating the caller?

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

Z0gS said:
I use the following code to run a batch file on the server side but it not
working. The code is working fine on a c# window console program. Can anyone
help me?
 
G

Guest

Yes I do impersonate an admin account. It can run a exe file but no batch fil

----- Eric Lawrence [MSFT] wrote: ----

It's very unlikely that the ASPNET worker progress has execute permission
on that batch file. Are you impersonating the caller

--
Thanks

Eric Lawrenc
Program Manage
Assistance and Worldwide Service

This posting is provided "AS IS" with no warranties, and confers no rights

Z0gS said:
I use the following code to run a batch file on the server side but it no
working. The code is working fine on a c# window console program. Can anyon
help me
 
E

Eric Lawrence [MSFT]

Perhaps try running @"cmd /k C:\batch.bat" instead of just the batch file
alone?

Z0gS said:
Yes I do impersonate an admin account. It can run a exe file but no batch file

----- Eric Lawrence [MSFT] wrote: -----

It's very unlikely that the ASPNET worker progress has execute permissions
on that batch file. Are you impersonating the caller?

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

Z0gS said:
I use the following code to run a batch file on the server side but
it not
working. The code is working fine on a c# window console program. Can anyone
help me?
myProcess.StartInfo.FileName = "C:\\mapDrv.bat";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
 
G

Guest

I got an error, cannot find specific file

----- Eric Lawrence [MSFT] wrote: -----

Perhaps try running @"cmd /k C:\batch.bat" instead of just the batch file
alone?

Z0gS said:
Yes I do impersonate an admin account. It can run a exe file but no batch file
----- Eric Lawrence [MSFT] wrote: -----
It's very unlikely that the ASPNET worker progress has execute
permissions
on that batch file. Are you impersonating the caller?
-- Thanks,
Eric Lawrence
Program Manager
Assistance and Worldwide Services
This posting is provided "AS IS" with no warranties, and confers no rights.
I use the following code to run a batch file on the server side but
it not
working. The code is working fine on a c# window console program. Can anyone
help me?
myProcess.StartInfo.FileName = "C:\\mapDrv.bat";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
 

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,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top