Loading ...
Sorry, an error occurred while loading the content.

Re: Calling executables with spaces in Perl

Expand Messages
  • Eyeless Devil
    ... When I tried this, a 2nd dialogue came up without executing the app. After looking at the help for START, I noticed that the first param is a title string.
    Message 1 of 6 , Jul 7, 2004
    • 0 Attachment
      --- In perlguitest@yahoogroups.com, "bullitt133" <noel.peterson@a...>
      wrote:
      > How do I go about calling an executable that has spaces in it.
      > Below is what my code currently looks like which returns the error
      > of: Couldn't find the file "ProfEdit.exe".
      > ...
      > ###Creating Resize Profile
      > system ("start \"Dr.DivX ProfEdit.exe\"");
      > sleep 2;
      >
      > I have tried it without the \ and with single quotes with no
      > success. Any help would be greatly appriciated.

      When I tried this, a 2nd dialogue came up without executing the app.
      After looking at the help for START, I noticed that the first param
      is a title string. When I put two escaped quotes or basically an
      empty string placeholder, it finally executed:

      my (@args) = ("start", "\"\"", "\"C:\\Documents and
      Settings\\setup.exe\"",);
      system(@args)==0 or die "@args failed: $?";
    • Gabor Szabo
      ... for more readability you might want to use qq() or q() for this my @args = ( start , q( ), q( C: Documents and Settings setup.exe )); (beware, I have not
      Message 2 of 6 , Jul 18, 2004
      • 0 Attachment
        On Wed, 7 Jul 2004, Eyeless Devil wrote:

        >
        > When I tried this, a 2nd dialogue came up without executing the app.
        > After looking at the help for START, I noticed that the first param
        > is a title string. When I put two escaped quotes or basically an
        > empty string placeholder, it finally executed:
        >
        > my (@args) = ("start", "\"\"", "\"C:\\Documents and
        > Settings\\setup.exe\"",);
        > system(@args)==0 or die "@args failed: $?";

        for more readability you might want to use qq() or q() for this

        my @args = ("start", q(""), q("C:\Documents and Settings\setup.exe"));

        (beware, I have not checked this now)

        Gabor
      Your message has been successfully submitted and would be delivered to recipients shortly.