Saturday, January 5, 2008

Create a Desktop Shortcut on the All Users Desktop

This script will create a shortcut on the All Users Desktop.

'Define the All Users desktop file path.
allusersdesktop = "C:\Documents and Settings\All Users\Desktop"

set WshShell = WScript.CreateObject("WScript.Shell")
set oShellLink = WshShell.CreateShortcut(allusersdesktop & "\VBSBob.lnk")
'Define where you would like the shortcut to point to. This can be a program, Web site, etc.
oShellLink.TargetPath = ""
oShellLink.WindowStyle = 1
'Define what icon the shortcut should use. Here we use the explorer.exe icon.
oShellLink.IconLocation = "C:\WINDOWS\explorer.exe"
oShellLink.Description = "VBSBob"
oShellLink.WorkingDirectory = allusersdesktop

1 comment:

Leslie Lim said...

Thanks to the writer of this article. I appreciate your effort in making this informational blogs. I know it's not easy to do this but you have done a really great job. Congrats. I'm pretty sure your readers enjoying it a lots.