I think the TargetPath and Arguments are 2 separate properties. Therefore it 
would make sense to put quotes around the TargetPath if
it looks like it contains spaces.  Try if this works:

 

    $oShellLink->{TargetPath} = 'c:\foo\foo.exe';

    $oShellLink->{Arguments}  = '23.14.15.20 1024';

 

Cheers,

-Jan

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: August 30, 2007 11:05 AM
To: activeperl@listserv.ActiveState.com
Subject: Win32 Wscript.Shell puts quotes around TargetPath?

 


Gurus, 

I'm using a new part of WMI here, so I'm sort of lost.  I'm trying to create a 
desktop shortcut using Wscript.Shell. The problem
I've got is the TargetPath method keeps putting double-quotes around the Target 
text, so the shortcut can't read it. 

----------------------- code ---------------------- 
use Win32::OLE; 

my $WshShell = Win32::OLE->new( 'Wscript.Shell' ); 

my $oShellLink = $WshShell->CreateShortcut( 'foo.lnk' ); 

$oShellLink->{TargetPath} = 'c:\\foo\\foo.exe 23.14.15.20 1024'; 

$oShellLink->Save(); 

$oShellLink = undef; 
-------------------------- code --------------------------- 

The shortcut gets created, but when I open the properties tab for it, the 
"Target" text, c:\foo\foo.exe, is surrounded by double
quotes. If I hand-delete the quotes and then double-click on the shortcut, 
foo.exe gets "found" and starts running, otherwise (with
the quotes in place), a search window starts looking for it.  Is there a method 
in this object to suppress those quotes? Or am I
missing something less obscure? Or less obvious? 

I've tried assigning and using a variable for the target path: 

$target = 'c:\\foo\\foo.exe 23.14.15.20 1024'; 
$oShellLink->{TargetPath}= $target; 

But that doesn't help. 

Any suggestions?   

TIA, 

Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150

My goal is simple. It is complete understanding of the universe, why it is as 
it is and why it exists at all. -- Stephen Hawking

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to