Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Extracting files from .7z using Perl

by BillKSmith (Monsignor)
on Jun 12, 2017 at 20:48 UTC ( [id://1192631]=note: print w/replies, xml ) Need Help??


in reply to Extracting files from .7z using Perl

I have had problems with directory names which include a space. Try the "short name" instead. You can use the /X option of dir to find it. It probably is PROGRA~1 for Program Files. Even if this 'works', I would consider it a debug aid, not a permanent fix.

UPDATE: Add example of using system with windows. I expect that it will run on most windows machines. It demonstrates how much the short names and forward slashes can simplify the quoting. The following example displays the perlmonks forum using Microsoft internet explorer.

use strict; use warnings; my $browser = 'iexplore.exe'; my $arg1 = 'http://perlmonks.com'; my $cmd; $cmd = "C:/PROGRA~1/INTERN~1/$browser"; print "$cmd, $arg1\n"; print "hit any key to run command. Close IE to contine."; <>; system $cmd, $arg1; print "Back again\n"; $cmd = "\"C:\\Program Files\\Internet Explorer\\$browser\""; print "$cmd, $arg1\n"; print "hit any key to run command. Close IE to continue."; <>; system $cmd, $arg1; print "Back again\n";
Bill

Replies are listed 'Best First'.
Re^2: Extracting files from .7z using Perl
by herveus (Prior) on Jun 13, 2017 at 13:33 UTC
    Howdy!

    ...assuming that the file actually has a short name. One cannot rely on that being the case, I have learned, to my great annoyance.

    yours,
    Michael
      Yes, an excellent reason not to leave this in production code. If it works now, why not use it to debug the quoting by eliminating one big problem?
      Bill

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-19 13:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found