Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to run bat file with required permissions in C#
- SET SRC=%1
- SET DEST=%2
- xcopy /Y/I %SRC%*.txt %DEST%temp
- echo Done!
- var psi = new ProcessStartInfo(fileToRun);
- psi.Arguments = args;
- psi.RedirectStandardOutput = true;
- psi.RedirectStandardError = true;
- psi.WindowStyle = ProcessWindowStyle.Hidden;
- psi.UseShellExecute = false;
- psi.CreateNoWindow = true;
- Process cmdProc = Process.Start(psi);
- StreamReader output = cmdProc.StandardOutput;
- StreamReader errors = cmdProc.StandardError;
- cmdProc.WaitForExit();
- psi.UseShellExecute = true;
- psi.RedirectStandardOutput = false;
- psi.RedirectStandardError = false;
- psi.UserName = username;
- psi.Password = password;
- psi.RedirectStandardInput = true;
Add Comment
Please, Sign In to add comment