How to add authentication property for login to directory path when running batch file in WCF?
- by blankon91
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;
}