Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 07-02-2009
Member
 
Join Date: Nov 2008
Posts: 1,221
Change Windows shortcuts target path

My brother made a login on my computer and created a lot of windows shortcuts on his desktop and now the target path has changed so we need to modify these with a script.

Is there an easy way to do a recursive search for shortcut files and modify the target path for each one if it has a specific string in it?
Reply With Quote
  #2  
Old 07-02-2009
Member
 
Join Date: May 2008
Posts: 685
Re: Change Windows shortcuts target path

VB Code:

Code:
'delete the flash shortcut    
Dim shell As Object    
Dim link As Object    
Dim DesktopPath As String    
Set shell = CreateObject("WScript.Shell")    
DesktopPath = shell.SpecialFolders("AllUsersDesktop")    
fso.DeleteFile DesktopPath & "Agent Prospecting Presentation.lnk"     

'create a new flash shortcut   
Set shell = CreateObject("WScript.Shell")    
DesktopPath = shell.SpecialFolders("AllUsersDesktop")    
Set link = shell.CreateShortcut(DesktopPath & "Agent Prospecting Presentation.lnk")    

'link.Arguments = "1 2 3"    
link.Description = "Agent Prospecting Presentation"    

'link.HotKey = "CTRL+ALT+SHIFT+X"    
link.IconLocation = "C:WestfieldInsuranceWestfield_1to1F_v1.exe,1"    
link.TargetPath = "C:MyWestfieldPresentationWestfield_1to1F_v1.exe"    

'window style 3=maximized, 2=normal    
link.WindowStyle = 2    

'start in    
link.WorkingDirectory = "C:MyWestfieldPresentation"    
link.Save
Reply With Quote
  #3  
Old 07-02-2009
Member
 
Join Date: May 2008
Posts: 979
Re: Change Windows shortcuts target path

There is a program for MS Windows called shortcut. I use it to create shortcuts on the desktop, the start menu and URL shortcuts in Favourites.

Quote:
Shortcut [Version 1.10]

Creates, modifies or queries Windows shell links (shortcuts)

The syntax of this command is:

shortcut /F:filename /A:C|E|Q [/T:target] [/P:parameters] [/W:workingdir] [/R:runstyle] [/I:icon,index] [/H:hotkey] [/D:description]

/F:filename : Specifies the .LNK or .URL shortcut file.
/A:action : Defines the action to take (C=Create, E=Edit or Q=Query).
/T:target : Defines the target path and file name the shortcut points to.
/P:parameters : Defines the command-line parameters to pass to the target.
/W:working dir : Defines the working directory the target starts with.
/R:run style : Defines the window state (1=Normal, 3=Max, 7=Min).
/I:icon,index : Defines the icon and optional index (file.exe or file.exe,0).
/H:hotkey : Defines the hotkey, a numeric value of the keyboard shortcut.
/D:description : Defines the description (or comment) for the shortcut.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Change Windows shortcuts target path"
Thread Thread Starter Forum Replies Last Post
Unable to change/ disable the Windows Keyboard Shortcuts on windows 7 Qamar Operating Systems 3 27-02-2014 01:31 PM
Method to change the java path in Windows 7 Maal-Gaadi Windows Software 5 04-09-2011 08:03 PM
Change Default Windows Installation Path to Your Desired Path phones Tips & Tweaks 0 23-03-2009 11:32 PM
How do I change default Home path in Windows Vista Actionguy Operating Systems 3 19-02-2009 06:01 PM
how to change keyboard shortcuts of windows media player Daisyel Media Player 1 18-03-2007 03:17 PM


All times are GMT +5.5. The time now is 12:08 AM.