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

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

toddlengnickAuthor Commented:
for clarity's sake: I need to know how to program this to happen in VB6...
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..
KarenAnalyst programmerCommented:
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.Shell")
    ' To create a shortcut for the current user ONLY:
    UserDesktopPath = WSHShell.SpecialFolders("Desktop")
    ' To create a shortcut for ALL USERS:
    UserDesktopPath = WSHShell.SpecialFolders("AllUsersDesktop")
    EXEPath = "C:\PathToYourFile\YourFileName.exe"
    ShortcutTitle = "TEST"
    Set ShellLink = WSHShell.CreateShortcut(UserDesktopPath & "\" & ShortcutTitle & ".lnk")
    ShellLink.TargetPath = EXEPath
    ShellLink.IconLocation = EXEPath
    ShellLink.WorkingDirectory = EXEPath
    Set ShellLink = Nothing
    Set WSHShell = Nothing
End Sub
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

toddlengnickAuthor Commented:

This works great in XP... will this also work with Windows 7 and Vista?

Thank you!
KarenAnalyst programmerCommented:
Hi toddlengnick,

It works for me under Vista... unfortunately I don't have access to a Windows 7 machine so I cannot test it myself, but I cannot see why it wouldn't work on it too.

Also I can see that I have put something wrong... you should probably change

  ShellLink.WorkingDirectory = EXEPath


  ShellLink.WorkingDirectory = UserDesktopPath

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
toddlengnickAuthor Commented:
Got it - this works great - thank you for all your help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.