in reply to System command clips off last part of local url when folder name has a space in it

Usually you just have to wrap in shell parsed quotes:

my $url = '"C:/Code/Perl/Phi Kap/temp.html"'; system "start $url";

That should do it, as it will pass to the shell the following:

start "C:/Code/Perl/Phi Kap/temp.html"

HTH!


Dave

  • Comment on Re: System command clips off last part of local url when folder name has a space in it
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: System command clips off last part of local url when folder name has a space in it
by Popcorn Dave (Abbot) on Aug 16, 2004 at 18:44 UTC
    No luck. For whatever reason, it opens a command window only in the Phi Kap directory and I get the C:> staring back at me. It won't launch the browser at all.

    Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.

      I'm not sure if this means you haven't solved your problem yet or not. In case it does, this works for me regardless of where the url comes from:

      Update: Corrected typo: s[start][system].

      my $urlWithSpaces = 'C:/Code/Perl/Phi Kap/temp.html'; system qq["$url"];

      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
        my $urlWithSpaces = 'C:/Code/Perl/Phi Kap/temp.html'; start qq["$url"];

        Where are you getting the bareword 'start' to do something? You also are using two difference variable names. I just get

        syntax error at - line 2, near "start qq["$url"]"

        Perhaps you meant:

        my $url = 'C:/Code/Perl/Phi Kap/temp.html'; system( qq[start "Title" "$url"] );

        (Note the inclusion of "Title" to tell start that $url isn't a window title desptie it being inside of double quotes.)

        Or perhaps you left off some incantation that makes the code you wrote work?

        (Updated)

        - tye        

        Thank you BrowserUk, that does indeed work. Davido's suggestion in this node merely opened a window with a command prompt on my system, but wouldn't start the browser.

        I thought there should be some way to take advantage of windows auto loading programs based on their extentions. Thanks again!

        Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.