- - PR -
perl meets space-containing-folder-names
1
| 投稿者 | 投稿内容 | ||||||||
|---|---|---|---|---|---|---|---|---|---|
|
投稿日時: 2001-09-15 01:51
suppose a perl script attempts to run an application with an argument of file
using "system" function, it fails when both folder names have spaces. [code] @REM=' @echo off perl -wS %~nx0 %* goto :eof '; system(@ARGV); [\code] e.g. only [3] fails [1] FOO.bat notepad.exe "\"C:\Program Files\FreeAmp\ReadMe.txt\"" [2] FOO.bat "\"C:\Program Files\Windows NT\Accessories\wordpad.exe\"" C:\WINNT\setup.log [3] FOO.bat "\"C:\Program Files\Windows NT\Accessories\wordpad.exe\"" "\"C:\Program Files\FreeAmp\ReadMe.txt\"" WHY? all cases work outside of perl. I would appreciate if you come up with a workaround that beats MS idio(t)syncracy in space-contaminated folders. | ||||||||
|
投稿日時: 2001-09-15 02:03
oops. I goofed in [code] bracketing.
the perl script FOO.bat should read:
and the samples runs should look like this:
thanks | ||||||||
|
投稿日時: 2001-09-15 02:19
hmmm... the [code] quoting is still not cooperative. in the sample runs, all double-double quotes ("") should read ("\"). yes, a double quote (") followed by an escape (\) and another double quote ("). I swear. my humble apologies. | ||||||||
|
投稿日時: 2001-09-21 03:08
the easiest way I found so far is:
to use "cmd/b" as the first arg of perl's system() as below
I wonder this space-sensitivity in the first arg is a bug or feature? | ||||||||
|
投稿日時: 2001-09-21 10:46
sorry, I goofed again.
should be "start/b" in place of "cmd/b"
(my 'back-slash' char would be your 'YEN' sign) | ||||||||
1
