How to add authentication property for login to directory path when running batch file in WCF?

Posted by blankon91 on Stack Overflow See other posts from Stack Overflow or by blankon91
Published on 2012-09-05T03:10:06Z Indexed on 2012/09/05 9:38 UTC
Read the original article Hit count: 193

Filed under:
|
|

I have class in my WCF service to execute batch file. when I test to run the batch file in shared directory, everything is fine, the batch was executed, but when I try to run the batch file from secure diretory, I get error "ACCESS DENIED". How to add login property so I can access my secured directory to execute my batch file?

here is my code:

public string ExecuteBat()
        {   
            string hasil = "";
            ProcessStartInfo processInfo = new ProcessStartInfo(@"D:\Rpts\SSIS_WeeklyFlash_AAF_1.bat");
            processInfo.CreateNoWindow = true;
            processInfo.UseShellExecute = false;
            Process process = Process.Start(processInfo);
            process.WaitForExit();
            if (process.ExitCode == 0) { hasil = "BAT EXECUTED!"; }
            else { hasil = "EXECUTE BAT FAILED"; }
            return hasil;
        }

© Stack Overflow or respective owner

Related posts about c#

Related posts about process