|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Re: How to pass Windows filepaths on command lineby davido (Cardinal) |
| on Aug 28, 2014 at 17:55 UTC ( [id://1098896]=note: print w/replies, xml ) | Need Help?? |
|
Without code I can only guess what you are doing with @ARGV. I suspect you're using Getopt::Long, which is fine. If there's some other method of processing @ARGV that you're using we should probably know, because that may be relevant. That said, why don't you try perl test.pl --file="test.txt", and perl test.pl --file="C:\scripts\test.txt"? The shell will remove the double-quotes anyway, so unless there are special characters you want to preserve, the quoting isn't doing anything for you to begin with. Note the following:
In other words, even without quotes, the backslashes are preserved. Now try the same one-liner with double-quotes around the path. The output will demonstrate that the shell is stripping them away. Single quotes don't have that syntactic meaning under Windows. Dave
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||