Process.Start() throws an “Access Denied” error


When I execute a process through and try to redirect the output/error, I get the following error:

System.ComponentModel.Win32Exception (0x80004005): Access is denied at System.Diagnostics.Process.CreatePipe(SafeFileHandle& parentHandle, SafeFileHandle& childHandle, Boolean parentInputs) at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) ...

What could be wrong? Here is a repro:

string path = "C:\\batch.cmd"; using (Process proc = new Process()) { bool pathExists = File.Exists(path); if(!pathExists) throw new ArgumentException("Path doesnt exist"); proc.StartInfo.FileName = path; proc.StartInfo.WorkingDirectory = workingDir.FullName; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.RedirectStandardOutput = true; proc.Start(); //Exception thrown here proc.WaitForExit(); }


No decent reason for this to fail, the code has not yet gotten to a point where it would do anything security-sensitive. This is environmental, something on your machine is interfering. Reboot first, disable anti-malware next. If that doesn't help then use TaskMgr.exe, Processes tab and arbitrarily start killing processes, with some luck you'll hit the evil-doer. Ask questions about getting this machine stable again at superuser.com


You have to make sure that the account that execute your program have the rights to execute the program your trying to launch with the process.start, and that the account have the rights to create a pipe on the system .

HAve you tried to remove the redirectOutput ? If without redirecting the output you dont get the exception means that your user can't create a pipe, so you have to give this right to the user .


This should have the full file path and file name, trying to start a folder will result in this error.

string path = "C:\\test.exe"; proc.StartInfo.FileName = path;

Also does the application have administrative privileges?

<strong>Edit: if it is a batch file, it needs to have the extension .bat such as "batch.bat" to be run properly. Also if it is a batch file, it cannot be empty or else it will throw an exception.</strong>


  • Is there any way to create symbolic link in WIX installer?
  • How to grab parent process standard output?
  • c# run process on non-admin right
  • ASP.NET Capture and replace output in Global.asax
  • Start another EXE in Managed Code
  • NLog Configuration API: Using Layouts stored in variables
  • Is there a way to ensure one object reference per record in an ActiveRecord hierarchy?
  • Ruby: Why does this way of using map throw an error?
  • View Paypal shopping cart contents on my site
  • Generate a unique string based on a pair of strings
  • How to make stdcall from Go
  • Deleting a widget from QTableView
  • cd command not working with execvp
  • Timeout a query
  • How to enable large page memory for the JVM?
  • multidatatrigger with multibinding in ControlTemplate.Triggers
  • Is there a parser equivalent of 'fragment' marking in ANTLR4?
  • Problems with toDataURL HTML5 other ways to get canvas data?
  • Find JSON nested nodes using multiple string values
  • Exception creating JSON with LINQ
  • VSCode change debug shell to bash on windows
  • Error processing multiple files
  • Cloud Code function running twice
  • Updating both a ConcurrentHashMap and an AtomicInteger safely
  • Build Successful but not running on simulator
  • how to upload multiple files in c# windows application
  • Thread safety of a fluent like class using clone() and non final fields
  • Xcode 4 NSLog Macro link in Xcode 3
  • Converting a WriteableBitmap image ToArray in UWP
  • Switching to Release Build causes runtime error in Web Reference
  • How to install a .deb file on a jailbroken iphone programmatically?
  • Handling un-mapped Rest path
  • script to move all files from one location to another location
  • ILMerge & Keep Assembly Name
  • Symfony2: How to get request parameter
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • File not found error Google Drive API
  • Qt: Run a script BEFORE make
  • reshape alternating columns in less time and using less memory
  • How to load view controller without button in storyboard?