How to create desktop shortcut?

Author Message
  • Total Posts : 192
  • Scores: 1
  • Reward points : 0
  • Joined: 8/15/2005
How to create desktop shortcut? - Thursday, October 26, 2006 7:06 AM
Hi all,
The objective is to create a URL Shortcut onto a group of SMS client desktops. I am thinking of creating a vbs file, and using SMS Software rollout.
The vbs file is shown as follows:
                 Dim sFile 
                 Dim dFolder
                 Dim objFSo
                 Set objFSo=createobject("Scripting.FileSystemObject")
                 sFile = \\SMSServer\Scripts\shortcut.vbs     ' This is my SMS Local  drive
                 dFolder = "%AllUserProfile%\Desktop" ' This is the targeted computer
                 objfso.copyfile sfile, dfolder
Is this script work? How about if I want to delete any known shortcut, on the all user profiles\ desktop, before the new shortcut is copied?
Thanks in advance!

  • Total Posts : 502
  • Scores: 52
  • Reward points : 111380
  • Joined: 6/1/2002
  • Location:
RE: How to create desktop shortcut? - Thursday, October 26, 2006 8:55 AM
You could use SMS Installer...

  • Total Posts : 5126
  • Scores: 504
  • Reward points : 202090
  • Joined: 9/13/2001
  • Location: Sherry Kissinger
RE: How to create desktop shortcut? - Thursday, October 26, 2006 2:36 PM
For deleting all instances of an icon within c:\documents and settings\ <all folders> \desktop, I've used the attached vbscript.  I didn't write it, and I actually don't quite understand it, but it works and that's all that matters to me.  That particular example is to delete a shortcut called 'flow.url' from the quick launch and from the desktop of any profiles in c:\documents and settings.
To add a URL shortcut on the desktop, you could use something like this w/vbscript.  If you want the AllUsers desktop instead of current user, just switch it in the code.  If you use all user, you can run it via SMS 'whether or not user is logged in'.  The script below would delete the Our Intranet.URL file before making the one you want.
Set sho = Wscript.CreateObject("Wscript.Shell")
Set fso = wscript.CreateObject("Scripting.FileSystemObject")
strUserProfile = sho.expandenvironmentstrings("%Userprofile%")
strAllUsersProfile = sho.expandenvironmentstrings("%AllUsersProfile%")
If fso.fileexists (struserprofile & "\Desktop\Our Intranet.URL") then
   fso.deletefile(struserprofile & "\Desktop\Our Intranet.URL")
   Set MyFile = fso.CreateTextFile(struserProfile & "\Desktop\Our Intranet.URL", True)
End If 
Attachments are not available: Download requirements not met - - -

  • Total Posts : 612
  • Scores: 27
  • Reward points : 30880
  • Joined: 9/7/2004
  • Location: Cincinnati
RE: How to create desktop shortcut? - Friday, October 27, 2006 11:17 AM
Dim WshShell
set WshShell = CreateObject("wscript.Shell")
DesktopPath="C:\Documents and Settings\All Users\Desktop"
ShortcutName="My Shortcut.url"
Set Shortcut = WSHShell.CreateShortcut(DesktopPath & "\" & ShortcutName)
Shortcut.TargetPath = ShortcutPath

  • Total Posts : 302
  • Scores: 7
  • Reward points : 25860
  • Joined: 3/23/2005
RE: How to create desktop shortcut? - Friday, October 27, 2006 11:29 AM
You could also use makescut.exe, a free utility that I use in our KiXtart scripts.  It's part of a larger free toolkit from ScriptLogic.
Here's a snippet on the syntax I use in KiXtart to generate a desktop icon in 2000/XP... it's got more options, but I only use the basic settings.
%COMSPEC% /C makescut.exe /n %userprofile%\desktop\Notepad.lnk /t c:\windows\notepad.exe /o"

  • Total Posts : 81
  • Scores: 0
  • Reward points : 0
  • Joined: 11/23/2004
  • Location: Southern Sunny England
RE: How to create desktop shortcut? - Friday, August 10, 2007 11:33 AM
That is a brilliant little script, thanks for sharing that with us all!