locked
space in file path!

    Question

  • 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
    Wednesday, October 12, 2005 10:46 AM

Answers

  • 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 11:32 AM

All replies

  • 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 11:32 AM
  • thanks mattias for ur response and it works now...

    regards
    swingme
    Wednesday, October 12, 2005 12:03 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.
    Thursday, March 16, 2006 1:19 PM