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

Re: Calling executables with spaces in Perl

Expand Messages
  • Dennis K. Paulsen
    Hello, I m not sure I ve ever used system() with a filename such as this, but here are a couple of options that I see: Cruddy Option 1: ren Dr.DivX
    Message 1 of 6 , Feb 1, 2004
      Hello,
      I'm not sure I've ever used system() with a filename such as this,
      but here are a couple of options that I see:

      Cruddy Option 1:
      ren "Dr.DivX ProfEdit.exe" "ProfEdit.exe"

      Option 2:
      Look into using CreateProcess (Win32::API)

      Option 3:
      Direct this question to perlmonks.org or
      http://groups.yahoo.com/group/perl to see if there is some obscure
      way to do this using system()


      Regards,
      Dennis K. Paulsen

      --- 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".
      >
      > use Win32::GuiTest qw(SendLButtonUp SendLButtonDown SendKeys
      > MouseMoveAbsPix);
      > use Getopt::Long;
      > use File::stat;
      > use Time::localtime;
      >
      > ###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.
    • Steve DeRidder
      What about using the short name from the old DOS 8.3 days. DRDIVX~1.EXE = Dr.DivX ProfEdit.exe Untested: system ( start DRDIVX~1.EXE ); Dennis K. Paulsen
      Message 2 of 6 , Feb 2, 2004
        What about using the short name from the old DOS 8.3 days.
        DRDIVX~1.EXE = Dr.DivX ProfEdit.exe

        Untested:
        system ("start DRDIVX~1.EXE");




        "Dennis K. Paulsen" <ctrondlpaulsden@...> wrote:
        Hello,
        I'm not sure I've ever used system() with a filename such as this,
        but here are a couple of options that I see:

        Cruddy Option 1:
        ren "Dr.DivX ProfEdit.exe" "ProfEdit.exe"

        Option 2:
        Look into using CreateProcess (Win32::API)

        Option 3:
        Direct this question to perlmonks.org or
        http://groups.yahoo.com/group/perl to see if there is some obscure
        way to do this using system()


        Regards,
        Dennis K. Paulsen

        --- 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".
        >
        > use Win32::GuiTest qw(SendLButtonUp SendLButtonDown SendKeys
        > MouseMoveAbsPix);
        > use Getopt::Long;
        > use File::stat;
        > use Time::localtime;
        >
        > ###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.



        ---------------------------------
        Yahoo! Groups Links

        To visit your group on the web, go to:
        http://groups.yahoo.com/group/perlguitest/

        To unsubscribe from this group, send an email to:
        perlguitest-unsubscribe@yahoogroups.com

        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



        ---------------------------------
        Do you Yahoo!?
        Yahoo! SiteBuilder - Free web site building tool. Try it!

        [Non-text portions of this message have been removed]
      • Ovidiu Padurean
        Hello all, you can try something like: my (@args) = ( start , application_path Dr.DivX ProfEdit.exe ,); system(@args)==0 or die system @args failed: $?
        Message 3 of 6 , Feb 3, 2004
          Hello all,

          you can try something like:

          my (@args) = ("start","\"application_path\\Dr.DivX ProfEdit.exe\"",);
          system(@args)==0 or die "system @args failed: $?"

          for more details: http://www.perldoc.com/perl5.8.0/pod/func/system.html

          Best regards,
          Ovidiu



          ----

          Home, no matter how far...
          http://www.home.ro
        • 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 4 of 6 , Jul 7, 2004
            --- 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 5 of 6 , Jul 18, 2004
              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.