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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add web shortcut to startup menu 1

Status
Not open for further replies.
Nov 18, 2005
43
US
Hi I have successfully added a URL shortcut to a website in each users startup folder however I am wondering if this is possible via a vbscript. Does anyone have any reference for me. I am new at vb and do not know much.
Thanks.
 
Refer to my FAQ faq329-5798 which has sample code for programatically creating a shortcut.

Differeneces you will need to know is that you cn use the special folder StartMenu.

Also, if your shortcut is to a web page, change the LNK extension to a URL extension.

I hope you find this post helpful.

Regards,

Mark
 
I seem to be getting an error on line 2 chat 5. Saying error: Object required: "WshShell".

Not sure what that means because it seems to be there.

SET oFSO = Wscript.CreateObject("Scripting.FileSystemObject")
strDsk = WshShell.SpecialFolders("StartMenu")
' What is the label for the shortcut?
strshortcut = strDsk & "\Quick Time Stamp.url"
If Not oFSO.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
' What is the path to the shared folder?
oUrlLink.TargetPath = " oUrlLink.Save
End If
 
You've grabbed just a bit of the "Add In Code" without the references above it.

You need to add the following to the top of your above posted code:

Dim WshShell, oFSO
Set WshShell = CreateObject("Wscript.Shell")


I hope you find this post helpful.

Regards,

Mark
 
I just edited something you had sent me before: This works nice.

On Error resume next
SET fso = Wscript.CreateObject("Scripting.FileSystemObject")
SET WshShell = WScript.CreateObject("WScript.Shell")



'Desktop shortcut for ADP supervisor
strFavs = WshShell.SpecialFolders("AllUsersStartup")
strshortcut = strFavs & "\Enterprise eTime.url"
If Not fso.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = " oUrlLink.Save
End If

'Desktop shortcut for ADP time sheet
'Note: to create the icon for all users use the Special Folder AllUsersDesktop
strFavs = WshShell.SpecialFolders("AllUsersStartup")
strshortcut2 = strFavs & "\Quick Time Stamp.url"
If Not fso.FileExists(strshortcut2) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut2)
oUrlLink.TargetPath = " oUrlLink.Save
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top