Use Process.Start with parameters AND spaces in path

Even when you use the ProcessStartInfo Class, if you have to add spaces for arguments, then the above answers won’t solve the problem. There’s a simple solution. Just add quotes around arguments. That’s all. string fileName = @”D:\Company Accounts\Auditing Sep-2014 Reports.xlsx”; System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.FileName = “Excel.exe”; startInfo.Arguments = “\”” + fileName + … Read more

Replacing Process.Start with AppDomains

Application domains and cross-domain interaction is a very thin matter, so one should make sure he really understands how thing work before doing anything… Mmm… Let’s say, “non-standard” 🙂 First of all, your stream-creating method actually executes on your “default” domain (surprise-surprise!). Why? Simple: the method that you pass into AppDomain.DoCallBack is defined on an … Read more

How can I run an EXE program from a Windows Service using C#?

This will never work, at least not under Windows Vista or later. The key problem is that you’re trying to execute this from within a Windows Service, rather than a standard Windows application. The code you’ve shown will work perfectly in a Windows Forms, WPF, or Console application, but it won’t work at all in … Read more

How do I start a process from C#?

As suggested by Matt Hamilton, the quick approach where you have limited control over the process, is to use the static Start method on the System.Diagnostics.Process class… using System.Diagnostics; … Process.Start(“process.exe”); The alternative is to use an instance of the Process class. This allows much more control over the process including scheduling, the type of … Read more

Process.start: how to get the output?

When you create your Process object set StartInfo appropriately: var proc = new Process { StartInfo = new ProcessStartInfo { FileName = “program.exe”, Arguments = “command line arguments to your executable”, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true } }; then start the process and read from it: proc.Start(); while (!proc.StandardOutput.EndOfStream) { string … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)