Results 1 to 3 of 3

Thread: Change Windows shortcuts target path

  1. #1
    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?

  2. #2
    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

  3. #3
    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.

    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.

Similar Threads

  1. Replies: 3
    Last Post: 27-02-2014, 01:31 PM
  2. Method to change the java path in Windows 7
    By Maal-Gaadi in forum Windows Software
    Replies: 5
    Last Post: 04-09-2011, 08:03 PM
  3. Replies: 0
    Last Post: 23-03-2009, 11:32 PM
  4. How do I change default Home path in Windows Vista
    By Actionguy in forum Operating Systems
    Replies: 3
    Last Post: 19-02-2009, 06:01 PM
  5. Replies: 1
    Last Post: 18-03-2007, 03:17 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,806,926.85987 seconds with 16 queries