Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript desktop shortcut

Status
Not open for further replies.

Briandr

MIS
Jul 11, 2003
177
US
Hi,

Can someone provide a sample VBScript that will create a desktop shortcut for all users? I also want to code this so the icon I want to use gets copied down from a share?

Thanks.
 
That won't help. The icon is a separate entity. A shortcut merely points to it. You'll either have to pull it down locally or make sure the shortcut icon property points to a share.

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
I am aware that the icon file has to be pulled down separately. I also know with VB you can map drives and copy down files (i.e., the icon). I am just not sure how to do it. I might be able to draw on my small collection of vbscripts I collected over time and piece something together.

I just figured someone from here could whip something up fast.
 
Great resource

map a drive
Code:
set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "P:", "\\server\share"

copy a file
Code:
set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\source\file.txt", "D:\destination\file.txt"

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
create a shortcut
Code:
strShortcutFile = "c:\Documents and Settings\All Users\Desktop\SomeName.lnk"
set objLink = objShell.CreateShortcut(strShortcutFile)   
objLink.TargetPath = "C:\path\to\program"
objLink.Description = "Shortcut Description"
objLink.IconLocation = "\\server\share\file.ico"
objLink.WorkingDirectory = "C:\path\to\program"
objLink.Save

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
good ideas. I am probably looking at copying the ico file down to a directory on c:\.

thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top