
BillKSmith
Veteran
Apr 18, 2010, 8:13 PM
Post #1 of 1
(7168 views)
|
quotes in exec paths
|
Can't Post
|
|
I am using ActiveState 5.8.8 under XP Home. I want to display a web page by running Microsoft Internet Explorer with the perl exec command. The names of two of the folders in the browser path contain space characters. The windows command prompt program (shell) requires quotes around the path to resolve the ambiquity that these spaces cause. The following command executes correctly from the command prompt: "C:\Program Files\Internet Explorer\iexplore.exe" ask.com My question is, how can I submit this command from perl. The exec command in the following program throws an exception (Invalid Argument). The accompaning error message shows that the command was formed exactly as shown above. use strict; use warnings; my $BROWSER = q("c:\\) . q(Program Files\\) . q(Internet Explorer\\) . q(iexplore.exe") ; my $web_page = q(ask.com); exec $BROWSER, $web_page ; __END__ I am aware that I can work around the problem by using the short aliases for the folder names: use strict; use warnings; my $BROWSER = q(c:\\) . q(progra~1\\) # Program Files . q(intern~1\\) # Internet Explorer . q(iexplore.exe) ; my $web_page = q(ask.com); exec $BROWSER, $web_page ; __END__ Good Luck, Bill
|