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

Add shortcut to "Start" menu

Status
Not open for further replies.

DRH192

Programmer
Apr 25, 2005
96
GB
All,

I have a small app, built in MS Access that has a front end. In order to keep the front end up to date on each machine, I have a desktop short cut that points to a VBS file that will copy the latest version of the front end to their machine.

The problem however is that they are often hotdesking so as soon as they move to a new machine, the shortcut is not on their desktop.

Therefore I would like instead of adding the shortcut to desktop, to add it to the start menu for that machine, so the shortcut doesn't get lost.

I assumed this would be easy but I haven't found anything yet, Any help greatly appreciated.

Cheers
 
Have a look at the WshShell.SpecialFolders("AllUsersStartup") property.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Try something like this:

set sOldFilename=fso.GetFile(sdesktop & "\oldshortcut.lnk")
sOldFilename.Delete

set fldrs=shell.SpecialFolders
set shcut=CreateShortcut("AllUsersStartMenu", "newshortcut.lnk", _
"newshortcut_target")

Function CreateShortcut(sFolder, sFilename, sTarget)
Dim fso, shell, sFolderPath, sFullPath, sWrkDir
set fso=WScript.CreateObject("Scripting.FileSystemObject")
set shell=WScript.CreateObject("WScript.Shell")
sFolderPath=shell.SpecialFolders(sFolder)
sFullPath=sFolderPath & "\" & sFilename
sWrkDir="Working Dir"
if fso.FileExists(sFullPath) Then
WScript.Quit
End if
set CreateShortcut=shell.CreateShortcut(sFullPath)
CreateShortcut.TargetPath=sTarget
CreateShortcut.WorkingDirectory=sWrkDir
CreateShortcut.Save
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top