JayTreDoe357
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
set link = shell.CreateShortcut(SomeP athToAnExi stingShort Cut)
if link.TargetPath <> TheNewLocation then
link.TargetPath = TheNewLocation
link.Save
end if
if link.TargetPath <> TheNewLocation then
link.TargetPath = TheNewLocation
link.Save
end if
ASKER
Sorry yes you were correct on your first answer, I figured it out with your help. Thanks.
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.
original shortcut
\\server1\docs\project1
and need to change
\\server2\rootfolder\docs\
Essentially i need something that servers for "server1" and replaces it with \\server2\rootfolder\, and leaves the rest of the path intact as well.
ASKER