I would like to know how can I run a ".bat" file trough my web application, I tried using process but it doesn't get the argument...
Here is the part of the code..
System.Diagnostics.Process proc =
new System.Diagnostics.Process();proc.EnableRaisingEvents=
false;proc.StartInfo.FileName="C:\\Inetpub\\wwwroot\\Webshell\create.bat";
proc.StartInfo.Arguments="Pasta1 Pasta2";
proc.Start();
But it does not work, if I paste the command and the prompt it works fine..
Any help

Web Application Problem
aditya thatte
Try calling the .bat from the cmd.exe
proc.StartInfo.FileName= @"C:\Windows\system32\cmd.exe /C C:\Inetpub\wwwroot\Webshell\create.bat";
and also setting the WorkingDirectory of StartInfo to "C:\Inetpub\wwwroot\Webshell\".
I got some nasty behavior on executing processes in the past.Most of the times it's caused by missing properties that have to be initialized before calling the Start method.
Simon Clarke
GarfieldB
I just know that I'm using IIS(windows 2000) the full path to this app is "C:\Inetpub\wwwroot\Webshell\"
Thanks for helping
parkfield
Yento
timlajaunie
Is there a chance that your IIS runs Chrooted (jailed to understand that his root is C:\inetpub\wwwroot and not C:\)
Harry Pfleger
I've tried changing the names and some other things, but no success...
The most strange is that in an Desktop application the first code works....(but shows the prompt and close automatically) but in a web don't !
guoliang12
Any other
MadsNissen
pascalh
To avoid confusion with escaping the slashes in C# , just put a @ in front of the string.@ means that the string is literal.Also set UseShellExecute property of StartInfo to true, as it's a command prompt.I'm not sure if it's make any difference, but i use it just in case.So your code is:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents=false;
proc.UseShellExecute = true;
proc.StartInfo.FileName= @"C:\Inetpub\wwwroot\Webshell\create.bat";
proc.StartInfo.Arguments="Pasta1 Pasta2";
proc.Start();
Thanx,
Giz.-
AVI13
that will give the stirng path the Root Folder path, which is your actuall working dir.