Groups > Microsoft > Windows PowerShell > RE: Shortcuts w/ Favicon?




Shortcuts w/ Favicon?

Shortcuts w/ Favicon?
Sat, 12 Apr 2008 22:44:40 -070
The shortcut works fine, but I can't seem to get it to use the
favorite icon.

$wsh = new-object -com "WScript.Shell"
$FileName = "C:\Documents and Settings\xxx\Desktop\CNN.lnk"
$shortcut = $wsh.CreateShortcut($FileName)
$shortcut.IconLocation = "http://www.cnn.com/favicon.ico"
$shortcut.TargetPath = "http://www.cnn.com"
$shortcut.Save()

What am I missing?

__________________
Post Reply
RE: Shortcuts w/ Favicon?
Sun, 13 Apr 2008 23:46:01 -070
As far as I remember .LNK files generally do not support IconLocation beeing 
specified as an URL. Internet Shortcut files (.URL) do.

$isc= @'
[InternetShortcut]
URL=http://www.cnn.com/
IconFile=http://www.cnn.com/favicon.ico
IconIndex=1
'@
sc "$($env:userprofile)\Desktop\CNN.url" $isc


-- 
Gerd


"Barry S." wrote:

> The shortcut works fine, but I can't seem to get it to use the
> favorite icon.
> 
> $wsh = new-object -com "WScript.Shell"
> $FileName = "C:\Documents and Settings\xxx\Desktop\CNN.lnk"
> $shortcut = $wsh.CreateShortcut($FileName)
> $shortcut.IconLocation = "http://www.cnn.com/favicon.ico"
> $shortcut.TargetPath = "http://www.cnn.com"
> $shortcut.Save()
> 
> What am I missing?
> 
> __________________
> Note: To reply, replace the word 'spam' embedded in return address with
'mail'.
Post Reply
RE: Shortcuts w/ Favicon?
Sun, 13 Apr 2008 23:53:00 -070
The IconIndex=1 is nonsense of course, it's a leftover from my sample file.

-- 
Gerd


"Gerd Schneider" wrote:

> As far as I remember .LNK files generally do not support IconLocation
beeing 
> specified as an URL. Internet Shortcut files (.URL) do.
> 
> $isc= @'
> [InternetShortcut]
> URL=http://www.cnn.com/
> IconFile=http://www.cnn.com/favicon.ico
> IconIndex=1
> '@
> sc "$($env:userprofile)\Desktop\CNN.url" $isc
> 
> 
> -- 
> Gerd
> 
> 
> "Barry S." wrote:
> 
> > The shortcut works fine, but I can't seem to get it to use the
> > favorite icon.
> > 
> > $wsh = new-object -com "WScript.Shell"
> > $FileName = "C:\Documents and Settings\xxx\Desktop\CNN.lnk"
> > $shortcut = $wsh.CreateShortcut($FileName)
> > $shortcut.IconLocation = "http://www.cnn.com/favicon.ico"
> > $shortcut.TargetPath = "http://www.cnn.com"
> > $shortcut.Save()
> > 
> > What am I missing?
> > 
> > __________________
> > Note: To reply, replace the word 'spam' embedded in return address
with 'mail'.
Post Reply
about | contact