Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating desktop shortcut icons

5,433 views
Skip to first unread message

Nick Fletcher

unread,
Jan 24, 2005, 11:32:33 AM1/24/05
to
Please can some help me.
I need to create a shortcut on the users All users\Desktop folder.
Can someone help with a sampel script please?
FYI the shortcut is called Compass. It currently resides in
\\myserver\desktop shotcuts\ and I would like it to go to C:\Documents and
settings\All users\desktop
Thanks
Nick


Torgeir Bakken (MVP)

unread,
Jan 24, 2005, 11:50:36 AM1/24/05
to
Nick Fletcher wrote:

Hi


Here is an example:

'--------------------8<----------------------

' Create Lock Workstation shortcut in the All Users Desktop folder

Set oShell = CreateObject("WScript.Shell")

sAllUsersDesktopPath = oShell.SpecialFolders("AllUsersDesktop")

sWinSysDir = oShell.ExpandEnvironmentStrings("%SystemRoot%\System32")

Set oShortCut = oShell.CreateShortcut( _
sAllUsersDesktopPath & "\Lock Workstation.lnk")

oShortCut.TargetPath = sWinSysDir & "\Rundll32.exe"
oShortCut.Arguments = "User32.dll,LockWorkStation"
oShortCut.IconLocation = sWinSysDir & "\Shell32.dll,47"
oShortCut.Save

MsgBox "Lock Workstation shortcut is now created.", _
vbInformation + vbSystemModal, "Create shortcut"
'--------------------8<----------------------


WSH 5.6 documentation (local help file) can be downloaded from here
if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp

--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

0 new messages