INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Jobs from Indeed

vbscript desktop shortcut

vbscript desktop shortcut

(OP)
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.

RE: vbscript desktop shortcut

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
 

RE: vbscript desktop shortcut

(OP)
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.

RE: vbscript desktop shortcut

Great resource
http://raqxtr.sstar.com/caspdoc/html/vbscript_language_reference.htm

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
 

RE: vbscript desktop shortcut

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
 

RE: vbscript desktop shortcut

(OP)
good ideas. I am probably looking at copying the ico file down to a directory on c:\.

thanks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close