ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-users
perl-win32-users
Re: Back-slashes & calling a batch file from perl ???
by $Bill Luebkert other posts by this author
Oct 27 2005 7:57PM messages near this date
view in the new Beta List Site
Re: Back-slashes & calling a batch file from perl ??? | Re: Back-slashes & calling a batch file from perl ???
Michael D Schleif wrote:
>  I have a perl script that calls a batch file (necessary), and passes it
>  two arguments.  The first argument is a directory name, and the second a
>  simple label.
>  
>  When I used forward-slashes (/) everywhere, the perl script behaves as
>  expected; but, the batch file refuses to recognize the legitimacy of the
>  directory name; at least in the context of passing it to the batch file
>  in a system() call, as I need to parse the exit codes.
>  
>      my $dir = "E:/backup";
>  
>  Yes, I test `-d $dir' successfully.  The batch file refuses to accept
>  $dir while using forward-slashes.  I am using s/// to replace (/) with
>  any number of (\).  I have tried up to eight (8) back-slashes; but,
>  everytime the script mis-behaves, and I have not been able to complete
>  this simple task.
>  
>  What am I missing?
>  
>  What do you think?

The path you are passing to the batch file will need to use \'s.
Where's your code snippet ?

my $dir = 'c:\foo\bar';
my $label = 'label';
system qq{some-batch.bat "$dir" $label}; # quoted $dir in case blanks in path
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Michael D Schleif
Michael D Schleif
Chris Wagner
$Bill Luebkert
$Bill Luebkert
Michael D Schleif
$Bill Luebkert
Michael D Schleif
$Bill Luebkert
Michael D Schleif
$Bill Luebkert
James Sluka
Ted Zeng
$Bill Luebkert
Ted Zeng
Paul
Peter Eisengrein
Trevor Joerges
Jim Guion
$Bill Luebkert
James Sluka
$Bill Luebkert
Chris Wagner

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved