VBScript - Modify a shortcut (NOT CREATE ANOTHER ONE)

Greetings,
     I was wondering if there was anyway to modify a shortcut though a VBScript. EX) I have a desktop shortcut, that's path points to one server. I want to be able to run this script which MODIFYs the shortcuts path to point to another server. ie. original target path is \\server01\file.exe and I want it to point to \\server02\file.exe. I have searched the internet and I have only found how to create a new shortcut.

Thanks in advance,
Jason
JayTreDoe357Asked:
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.

grayeCommented:
Actually it's the same thing....   You use the Shell.CreateShortcut to both create a new shortcut *and* to modify an existing one.  So you probably already have the solution you need.

... I guess they were too lazy to come up with a EditShortcut method ?
0

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
JayTreDoe357Author Commented:
The problem with that is... how do I read what is already there for targetpath?
0
grayeCommented:
set link = shell.CreateShortcut(SomePathToAnExistingShortCut)
if link.TargetPath <> TheNewLocation then
          link.TargetPath = TheNewLocation
          link.Save
end if
0
JayTreDoe357Author Commented:
Sorry yes you were correct on your first answer, I figured it out with your help. Thanks.
0
SmallPrintCommented:
What if I need a script that takes

original shortcut
\\server1\docs\project1

and need to change
\\server2\rootfolder\docs\project1

Essentially i need something that servers for "server1" and replaces it with \\server2\rootfolder\, and leaves the rest of the path intact as well.
0
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
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.