Valcon Systems. > Customer Support > Knowledgebase

This Script will place a shortcut on a user's desktop


'This Script will place a shortcut on a user's desktop
'and change the Icon File associated with the shortcut

set objFSO=CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
sUserDesktop = objShell.SpecialFolders("Desktop")

'Modify Variables in this section
IconSourceFile= "\\SERVER\netlogon\ICONFILE.ico" 'Source file for display icon
IconFolder=sUserProfile & "\Icons\" 'Folder that the IconSourceFile will be copied to (c:\documents and settings\%username%\ICONS)
IconFile= "ICONFILE.ico" 'Icon File Name (to be saved on local computer)
ShortcutName= "\SHORTCUT NAME.lnk" 'Name of the Shortcut to appear on Desktop
URL= "http://WWW.GOOGLE.COM" 'URL/Webaddress

IF NOT objFSO.FileExists (IconFolder & IconFile) Then
IF NOT objFSO.FolderExists (IconFolder) Then
objFSO.CreateFolder (IconFolder)
End if
objFSO.CopyFile IconSourceFile, IconFolder, TRUE
End If
Set objShortcutUrl = objShell.CreateShortcut(sUserDesktop & ShortcutName)
objShortcutUrl.TargetPath = URL
objShortcutUrl.IconLocation = IconFolder & IconFile

Was this article helpful? yes / no
Article details
Article ID: 7
Category: Scripts
Date added: 2013-06-05 04:19:20
Views: 178
Rating (Votes): Article rated 2.7/5.0 (7)

« Go back