VBS Program shortcut script error.

March 28, 2010 at 08:50:33
Specs: Windows 7, n/a
I'm having a problem with a vbs script to create a shortcut on the desktop for a school project.

Source Code:
'Programmer: Havocide
'Created on: 3/28/2010
'Purpose: Create a shortcut on my desktop to Yahoo Messenger

Dim objShell, strDir
Set objShell = CreateObject("wscript.Shell")
strDir = objShell.specialFolders("desktop")

set shortcut = objShell.createShortcut(strDir & "\YahooMessenger.Ink")
shortcut.targetpath = "C:\Program Files (x86)\Yahoo!\Messenger\YahooMessenger.exe"

shortcut.description = "A link to Yahoo Messenger"
shortcut.HotKey = "ctrl+alt+Y"

When I try and execute this script I recieve a 80020009 error on line 9 saying that "The shortcut pathname must end with .Ink or .url.
Not sure what the problem is here because the pathname does end with .Ink.

Any and all help is welcome to help me solve this issue or show me where I went wrong.

See More: VBS Program shortcut script error.

Report •

March 28, 2010 at 16:03:26
it should be ".Lnk", not ".Ink" (I always capitalize my leading ells in code because of the similarity between captial i, l and espcecially digit one. If at all possible, this i think is a good practice unless it bombs the code.)

Report •

March 28, 2010 at 18:11:02
Thanks a ton! That was all it was. Changed the "Ink" to "LnK" and it created the shortcut. =) I knew it was something simple.

Report •
Related Solutions

Ask Question