Locked space in file path!

  • Wednesday, October 12, 2005 10:46 AM
     
     
    When i use  a file path like "C\ test cases\testfile.csv", the file cannot be opened..
    I know the problem is the space in my  path. If  i use "C\ testcases\testfile.csv", then its ok. Is there any tricks to come around this problem.

               ProcessStartInfo pSInfo          =  new ProcessStartInfo( "Excel.exe");
               pSInfo.WindowStyle               =  ProcessWindowStyle.Maximized;
               pSInfo.Arguments                   =  filePath;
               Process.Start(pSInfo);


    thanks n regards
    swingme

All Replies

  • Wednesday, October 12, 2005 11:32 AM
     
     Answered
    Try to put quotes around the path


    pSInfo.Argument = @"""c:\test cases\testfile.csv""";
     


    or if you prefer


    pSInfo.Argument = "\"c:\\test cases\\testfile.csv\"";

     

  • Wednesday, October 12, 2005 12:03 PM
     
     
    thanks mattias for ur response and it works now...

    regards
    swingme
  • Thursday, March 16, 2006 1:19 PM
     
     
    I have the same issue , but the problem is that it works on my development just fine (the file path without quotes) but on the client machine it doesn't work . I just want to know what is the root cause of the problem that spaces work on some machines and other machines it doeasn't.