toddlengnick
asked on
VB6 Shortcut to .exe put on desktop of Windows 7 and Vista machines
Please help me put a shortcut to the following file on the desktop of a Windows 7 and Vista machine:
c:\Program Files\Rorschach Scoring Trainer\Scoring Trainer.exe
Thanks!
c:\Program Files\Rorschach Scoring Trainer\Scoring Trainer.exe
Thanks!
I used to use the Visual Basic 6.0 Package and Deployment Wizard to define all the files to distribute.
I then use the target directory of %USERPROFILE%\desktop to save the icon too..
I then use the target directory of %USERPROFILE%\desktop to save the icon too..
oh dear...it's me again :)
Replace with your own values in the following, and choose from either "this user" or "all users"...
Public Sub CreateShortcut()
Dim WSHShell As Object
Dim ShellLink As Object
Dim UserDesktopPath As String
Dim EXEPath As String
Dim ShortcutTitle As String
Set WSHShell = CreateObject("WScript.Shel l")
' To create a shortcut for the current user ONLY:
UserDesktopPath = WSHShell.SpecialFolders("D esktop")
' To create a shortcut for ALL USERS:
UserDesktopPath = WSHShell.SpecialFolders("A llUsersDes ktop")
EXEPath = "C:\PathToYourFile\YourFil eName.exe"
ShortcutTitle = "TEST"
Set ShellLink = WSHShell.CreateShortcut(Us erDesktopP ath & "\" & ShortcutTitle & ".lnk")
ShellLink.TargetPath = EXEPath
ShellLink.IconLocation = EXEPath
ShellLink.WorkingDirectory = EXEPath
ShellLink.Save
Set ShellLink = Nothing
Set WSHShell = Nothing
End Sub
Replace with your own values in the following, and choose from either "this user" or "all users"...
Public Sub CreateShortcut()
Dim WSHShell As Object
Dim ShellLink As Object
Dim UserDesktopPath As String
Dim EXEPath As String
Dim ShortcutTitle As String
Set WSHShell = CreateObject("WScript.Shel
' To create a shortcut for the current user ONLY:
UserDesktopPath = WSHShell.SpecialFolders("D
' To create a shortcut for ALL USERS:
UserDesktopPath = WSHShell.SpecialFolders("A
EXEPath = "C:\PathToYourFile\YourFil
ShortcutTitle = "TEST"
Set ShellLink = WSHShell.CreateShortcut(Us
ShellLink.TargetPath = EXEPath
ShellLink.IconLocation = EXEPath
ShellLink.WorkingDirectory
ShellLink.Save
Set ShellLink = Nothing
Set WSHShell = Nothing
End Sub
ASKER
Snowberry,
This works great in XP... will this also work with Windows 7 and Vista?
Thank you!
This works great in XP... will this also work with Windows 7 and Vista?
Thank you!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Got it - this works great - thank you for all your help!
ASKER