/build/static/layout/Breadcrumb_cap_w.png

How to create desktop URL with icons

I'd like to automate the creation of a shortcut that points to a URL (with a specified icon image).

0 Comments   [ + ] Show comments

Answers (4)

Answer Summary:
Posted by: WGM_Jeff 12 years ago
4th Degree Black Belt
3
We created a shortcut with the icon, and zipped it up. Added it as a dependency, and then used a batch file to copy it to the Public Desktop for Windows 7. For XP you could copy it to the All Users Desktop.

Comments:
  • Wow.... so much easier then the way I was doing it. - dugullett 12 years ago
Posted by: andibogard 12 years ago
Blue Belt
2
I have a installation I run from a powershell script and part of the install is to create an icon. Although, It might be overly complicated for what you need.

$shortcut_name = "Name"
$shortcut_target = "URL"
$sh = new-object -com "WScript.Shell"
$p = $sh.SpecialFolders.item("AllUsersDesktop")
$lnk = $sh.CreateShortcut( (join-path $p $shortcut_name) + ".lnk" )
$lnk.TargetPath = $shortcut_target
$lnk.IconLocation = "C:\Windows\System32\url.dll"
$lnk.Save()
Posted by: NinjaInPA 12 years ago
Orange Senior Belt
1
' Below is a copy of a VBScript that I use to accomplish the job.
' This creates shortcuts on the desktop and on the quick lauch bar

'VBScript Begins here
On error resume next

Dim WshShell
Dim strDesktopPath, strAllUsers, strCurrentUser, QuickLaunch, strIconPath

Set WshShell = CreateObject("WScript.Shell")

strDesktopPath = WshShell.ExpandEnvironmentStrings("%AllUsersProfile%") & "\Desktop"
strAllUsers = WshShell.ExpandEnvironmentStrings("%AllUsersProfile%")
strCurrentUser = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\Application Data\Microsoft\Internet Explorer\Quick Launch"
QuickLaunch = WshShell.ExpandEnvironmentStrings("%AllUsersProfile%") & "\Application Data\Microsoft\Internet Explorer\Quick Launch"


'Set the path to your custom icon below
strIconPath = strAllUsers & "\Application Data\YourIcons\MyIcon.ico"

Get_CopyIcon
Get_CreateShortcuts


Sub Get_CopyIcon

Set fso = CreateObject("Scripting.FileSystemObject")

'Copies your custom icon to the folder below, change "YourIcon" to your icon path
strFolder = strAllUsers & "\Application Data\YourIcons"
strFile = "MyIcon.ico"


'Copy 1
If not fso.FolderExists(strFolder) Then
FSO.CreateFolder strFolder
End If

If fso.FileExists(strIconPath) Then
FSO.DeleteFile strIconPath,True
End If

FSO.CopyFile strFile, strIconPath,True


End Sub

Sub Get_CreateShortcuts

'Add your URL on the line below
strURL = "http://www.itninja.com/question/how-to-create-desktop-url-with-icons"


Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\Name of your link.lnk")
objShortcutUrl.TargetPath = strURL
objShortcutUrl.IconLocation = strIconPath
objShortcutUrl.Save


Set objShortcutUrl = WshShell.CreateShortcut(QuickLaunch & "\Your Link Name.lnk")
objShortcutUrl.TargetPath = strURL
objShortcutUrl.IconLocation = strIconPath
objShortcutUrl.Save

Set objShortcutUrl = WshShell.CreateShortcut(strCurrentUser & "\Your Link Name.lnk")
objShortcutUrl.TargetPath = strURL
objShortcutUrl.IconLocation = strIconPath
objShortcutUrl.Save

End Sub

'End of VBScript
Posted by: Trinity 12 years ago
Brown Belt
0
WinXP - create a .ico file and copy it to %systemroot%\system32. Create a .lnk file pointing to the .ico file in the system32 directory. Copy the .lnk file to the All Users Desktop.

Win7 - I created an MSI using InstallShield that accomplishes something very similar but all the files are contained in the install directory. This also gave us the ability to report what users had what desktop short-cuts using Add/Remove Programs.

Comments:
  • trinity do you have a msi to create a shortcut on a desktop for winxp and win7 - brighstarcuit 11 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ