Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


script that replaces the target on a shortcut

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,3124
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> script that replaces the target on a shortcut
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 script that replaces the target on a shortcut - 5/26/2005 1:25:59 AM   
  moye

 

Posts: 2
Score: 0
Joined: 5/26/2005
From: United Kingdom
Status: offline
hi,
i am trying to do a script that will change the target in a shortcut to another target (e.g find and replace)
anyone out there have any ideas......very new to vb scripting

cheers
moye[:p]
 
 
Post #: 1
 
 Re: script that replaces the target on a shortcut - 5/26/2005 2:20:32 AM   
  Zifter


Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
You can simply replace the existing shortcut with a new shortcut, having the same name, but with a new TargetPath
      HTH

(in reply to moye)
 
 
Post #: 2
 
 Re: script that replaces the target on a shortcut - 5/26/2005 6:13:00 AM   
  Coquito

 

Posts: 29
Score: 0
Joined: 4/20/2005
From: USA
Status: offline
I'm trying to do the same with the "My Documents" folder found on the user's desktop but the script I'm using simply creates another My Documents.

'Creates desktop Icon on current users Desktop
Set objShell = WScript.CreateObject("WScript.Shell")
strDesktopFolder = objShell.SpecialFolders("Desktop")
Set objShortCut = objShell.CreateShortcut(strDesktopFolder & _
"\My Documents.lnk")
objShortCut.TargetPath = "\\data1\users\%username%"
objShortCut.Description = "User Home Drive."
objShortCut.HotKey = "Ctrl+Shift+H"
objShortCut.Save


Anyone know of a workaround?

(in reply to moye)
 
 
Post #: 3
 
 Re: script that replaces the target on a shortcut - 5/26/2005 9:23:26 AM   
  jbird

 

Posts: 33
Score: 0
Joined: 6/25/2004
From: USA
Status: offline
Coquito,
When I copy your code into notepad and run it everything works fine. Are you getting an error message when you run the script?

(in reply to moye)
 
 
Post #: 4
 
 Re: script that replaces the target on a shortcut - 5/26/2005 9:27:27 AM   
  Coquito

 

Posts: 29
Score: 0
Joined: 4/20/2005
From: USA
Status: offline
jbird,

No I dont get an error message. I just end up with two My Documents on the desktop. This is certainly going to confuse my users.

(in reply to moye)
 
 
Post #: 5
 
 Re: script that replaces the target on a shortcut - 5/27/2005 4:38:29 AM   
  moye

 

Posts: 2
Score: 0
Joined: 5/26/2005
From: United Kingdom
Status: offline
thanks for the speedie reply. i seem tro get the same jbird two icons. is there a script that will just change the target.

(in reply to moye)
 
 
Post #: 6
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> script that replaces the target on a shortcut Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts