in reply to How to pass Windows filepaths on command line

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:

perl -e "print qq{<<$_>>\n} for @ARGV" file=test\test\test __OUTPUT__ <<file=test\test\test>>

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