Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Proc::Background does not take file path with spaces

by Corion (Pope)
on Apr 27, 2012 at 07:29 UTC ( #967538=note: print w/ replies, xml ) Need Help??


in reply to Re: Proc::Background does not take file path with spaces
in thread Proc::Background does not take file path with spaces

The Windows command shell (cmd.exe) expects whitespace in arguments to be properly quoted, and "properly quoted" in its terms means to use double quotes to surround the file name.

As double quotes treat the backslash special, single-backslashing a space character doesn't make much sense to me. I would try

my $Command = q{"C:\Program Files (x86)\vs.exe"};

or the double-quoted variant

my $Command = qq{"C:\\Program Files (x86)\\vs.exe"};


Comment on Re^2: Proc::Background does not take file path with spaces
Select or Download Code
Re^3: Proc::Background does not take file path with spaces
by temporal (Pilgrim) on Apr 27, 2012 at 14:41 UTC

    Corion is correct, this is the way to do it. I usually write a quick sub that will process command line arguments for me:

    sub argify { while (my $aref = shift) { @$aref = map "/"$_/"", @$aref; } }
Re^3: Proc::Background does not take file path with spaces
by Anonymous Monk on Apr 27, 2012 at 17:14 UTC
    I tried the folllowing
    my $CommandNew = qq("C:\\Program Files (x86)\\vs.exe"); print "Command is $CommandNew\n"; my $ID = Proc::Background->new($CommandNew);

    ERROR: Test.pl: cannot find absolute location of "C:\Program

    Also tried
    my $CommandNew = q(C:\\Program Files (x86)\\vs.exe); print "Command is $CommandNew\n"; my $ID = Proc::Background->new($CommandNew);

    ERROR: Test.pl: no executable program located at C:\Program
    I am still stuck
Re^3: Proc::Background does not take file path with spaces
by dinasour (Novice) on Apr 27, 2012 at 17:16 UTC
    I tried the folllowing
    my $CommandNew = qq("C:\\Program Files (x86)\\vs.exe"); print "Command is $CommandNew\n"; my $ID = Proc::Background->new($CommandNew);

    ERROR: Test.pl: cannot find absolute location of "C:\Program

    Also tried
    my $CommandNew = q(C:\\Program Files (x86)\\vs.exe); print "Command is $CommandNew\n"; my $ID = Proc::Background->new($CommandNew);

    ERROR: Test.pl: no executable program located at C:\Program
    I am still stuck

      You are going to have to accept that Proc::Background is terminally broken and use something else.

      See Re: Proc::Background does not take file path with spaces for one such possibility.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967538]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2014-08-02 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (54 votes), past polls