[Mono-dev] Process.Start and Paths with single quote

Tom Philpot tom.philpot at logos.com
Tue Mar 22 20:40:51 EDT 2011


It seems that a Process Start()'d from a ProcessInfo with a
WorkingDirectory that contains one single quote (') causes problems for
Mono.

using System;
using System.IO;
using System.Diagnostics;

namespace SingleQuoteFolderProcessTest
{
 class MainClass
 {
  public static void Main (string[] args)
  {
   ProcessStartInfo info = new ProcessStartInfo();
   info.UseShellExecute = false;
   // hello world is a trival "Hello World" binary - left as an exercise
for the reader
   info.FileName = "helloworld";
   info.WorkingDirectory =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
 "iWork '09");
   
   using (Process.Start(info))
   {
   }
  }
 }
}


Interestingly enough, the following works fine

string dir = 
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
 "iWork '09");
string exe = Path.Combine(dir, "helloworld");
using (Process.Start(exe))
{
}



More information about the Mono-devel-list mailing list