Click here to Skip to main content
15,669,526 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am creating an application which runs a batch file and create an xml file as result which i am using for further processing. My problem is when i am running my application from local machine batch file is running fine,but when i am running it through IIS nohting is happening,

it meance process.start coudn't start command Prompt.

I am using following code. I have given all permission to iis.

Dim ProcessInfo As Diagnostics.ProcessStartInfo
ProcessInfo = New Diagnostics.ProcessStartInfo("cmd.exe", "/C " + Server.MapPath("~\myScript.bat"))

        Dim Process As New Diagnostics.Process

       ProcessInfo.CreateNoWindow = False
        ProcessInfo.UseShellExecute = False
        Process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal

        Process = Diagnostics.Process.Start(Server.MapPath("~\Spandata\RunSpan.exe"))

Updated 4-Sep-10 0:03am

1 solution

pratikngajjar wrote:

I have given all permissions to IIS.

I will take your words. The code also seems okay to me.

Do you see any error entry in the event log? Try putting the code in try-catch block and log the exception in the catch block. This would probably let you know why the code is not executing.

Additionally you may also check the link below,
Google search - run batch file on server[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900