Results 1 to 5 of 5

Thread: string

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    string

    Hi,
    If I run the following line in the RUN dialog box (i.e. start, run window) it works fine (Notice the double quotes at the beginning, middle and the end):
    "\\W-I55ZB6B7\c$\Program Files\game" \\psiukapp6\test.zip ckff.ckff.asc \\W-I55ZB6B7\c$\test"


    but when this line is created in c# it is not quite the same (Notice the double quotes) and therefore I can not run it using System.Diagnostics.Process.Start

    strLine = @"\\W-I55ZB6B7\c$\Program Files\game \\psiukapp6\test.zip capt.capt.asc \\W-I55ZB6B7\c$\test"

    System.Diagnostics.Process.Start(strLine)

    The error is: system can not find the file specified.

    How is it possible to make the c# created string as same as the one which can be run in the RUN dialog box?
    Thanks

  2. #2
    Member
    Join Date
    Sep 2002
    Location
    London
    Posts
    63
    for each backslash you need to add an extra one.

    so \ would become \\

    and \\ would become \\\\

    you could also try a single forward slash instead

    ie c:/data/myfile.txt

    I think there was another way where you could enter the path as is but can't remember how to do that now.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    start

    I don't think the problem is to do with back slash because this is really what I have

    string strUnzipPath = strUnzipLocation + " " + strPath + " " + strFullFilename + " " + strTempLocation;
    System.Diagnostics.Process.Start(strUnzipPath);

    note that
    strUnzipPath = "\"\\\\W-I55ZB6B7\\c$\\Program Files\\WinZip\\wzunzip\" \\\\psiukapp6\\pershusp\\History\\01-01-2004\\01-01-2004-pershing.zip capt.capt.asc \\\\W-I55ZB6B7\\c$\\farshad\\downloads"


    Thanks

  4. #4
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    String literals (as you originally had it fmardani) are a lot more readable IMO. Perhaps escaping the last double quotes might help you:
    Code:
    strLine = @"\\W-I55ZB6B7\c$\Program Files\game \\psiukapp6\test.zip capt.capt.asc \\W-I55ZB6B7\c$\test\""

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678
    Did what you suggested but still the error is: system can not find the file specified. :-( Thanks

    I think there has to be a " after strUnzipLocation as I have tried doing but it does not work.

    string strTempLocation = @"\\W-I55ZB6B7\c$\farshad\downloads";
    string strUnzipLocation = @"\\W-I55ZB6B7\c$\Program Files\WinZip\wzunzip.exe";
    string strPath = @"\\psiukapp6\pershusp\History\01-01-2004\01-01-2004-pershing.zip";
    string strFullFilename = "capt.capt.asc"

    string strUnzipPath = strUnzipLocation + " " + strPath + " " + strFullFilename + " " + strTempLocation;

    System.Diagnostics.Process.Start(strUnzipPath);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width