How To Bulk Replace Target Path In Shortcuts On Windows

64 views
Skip to first unread message

Saija Grzegorek

unread,
May 2, 2024, 11:29:40 AM5/2/24
to erconseperg

Is there a non-programmer-skilled way of updating all the shortcuts in one folder when the other folder changes name? I can open the properties of each shortcut and change the name in the target path, but there are hundreds of shortcuts and that would take too long to tack down all the shortcuts to manually change them.

i tried to edit this solution which i found here: Batch file (command line) to get target path of Internet Shortcut (.url) in the "URL:" field under "Web Document" tab by replacing the .url to .lnk but it doesn't work for me.

How to Bulk Replace Target Path in Shortcuts on Windows


Download Filehttps://t.co/yvevEjnKr1



I am looking for a way to automate changing 300+ shortcuts to a different target location. We are currently changing service providers, and need to adjust the shortcuts to reflect the new provider. The key is that only part of the shortcut needs to be changed, and part of it is different for every computer, everything past the '?'. Below is an example.

@Maher -- The shortcuts are in the all %allusersprofile%/desktop, without administrator perms no one can modify them. I already have all the shortcuts pointing to the old location, i just need to modify the whole lot of them, like i said 300+, and then i will replace them using a GPO Startup Script, also already written..

Rob, I tried the script that you wrote for the shortcuts, and it looks like it will work, but in the log, only part of the shortcut is listed as the target path. It sees all my shortcuts as just pointing to Internet explorer, when there is a whole string beyond that that gets passed to Internet Explorer, and that is what needs changing.

I was able to get your script to work for the arguments section of the shortcuts. As I have time i will work on writing that into the script to include the whole path, not just the target. Time will tell how it goes.. I might be getting in over my head on this but should be fun

This script searches the given folder (and sub-folders) for shortcuts that contains a particular string (i.e. "c:\temp\shortcut_target.exe" first it will prompt you to type the string you wish to replace, after which, it prompts for the new string. Finally, it will ask you for the root folder which you would like to begin the search (and replace). If you run in verbose mode, you will be prompted to say 'yes' for each shortcut you'd like to change. After it has finished, it will present you with an HTM of the changes that were made.

Just testing now...hugely useful. The post script auditing is just icing on the cake.We do server migrations and user desktop migrations constantly...and I use a differen method for link repairs as we need to assess things like link icons, link state (maximized or minimized), prior to making the change, and we need to track what was changed and when, and by whom.I am using a much more clunky method of querying all user shortcuts (using shortcut.exe) and stuffing the results into a log file, which is consolidated into a central db file, which is massaged for bad links in bulk. I then use the original file path (\\HOSTNAME\c$\Path\to\File.lnk) to rewrite the corrected link, attributes and all.Have you considered link auditing as a script?Do you have anything you've written or could write that would gather/query remote link information to a DB?I would love to be able to use VB to MS Access or BV to a delimited csv file if you have such a thing as I've yet to find any tool or script that does that in on go. Thank

This script just saved me hours and hours, thankyou so much!I just thought I would quickly also share that I had a problem running it on a windows 7 machine where it would rename anything with a space or a special character to an _So, "/path name/file,name" became "/path_name/file_name"I copied everything over to a win xp machine - worked perfectly!Thanks again :-)

After this number of navigations, the main explorer pane will show a normal .lnk shortcut called 'target(.lnk)', which points to the folder-shortcut's target. If this is opened, it will act like any other .lnk file normally would, removing the unusual path.

You can also create shortcuts like this in windows XP Pro, and 2000. The thread I found this on is located at: -Cool-trick-with-folder-shortcuts-(XP-Pro-2000)
To create the shortcuts in windows XP and 2000, follow the steps I have listed, but drag the shortcut onto the start button instead of the 'Start menu' folder. However, the above thread also mentions that in older versions, deleting the shortcut can delete the folder as well, so be cautious.

This article covers a simple method to bulk replace target path in shortcuts on Windows. When you create a shortcut on Windows, it saves the path to the original file which is called the target path. Each shortcut has a target path which leads it to the respective file stored in the directory. Clicking the software immediately opens the respective file listed in the target path.

LiNK Fixer is a free Windows program that you can use to bulk replace target path in shortcuts. With this program, you can select where you shortcuts are saved and then add the previous target path or directory and replace it with the current path or directory. If you just change the drive with the same folder structure, you can just type the drive letters and easily fix all the shortcuts by bulk replacing the target path.

LiNK Fixer is a handy little program that can save you lots of time fixing the shortcuts. It is one of the easiest ways to fix the broken shortcuts when the original file is moved. All you have to do is define the old and new paths and it will replace the target path in all the shortcuts. So, if you use shortcuts in Windows, give this program a try.

Option 3: Using PowerShellHere is a PowerShell script that automatically updates the shortcut target for .lnk files in a specified folder. This script automatically updates shortcuts that contain the old server name or path, replacing them with the new name or path.

@Dave: For now, please use the VBScript method (added in the article), which updates the target path, arguments, and the Start in directory automatically.Mark OOctober 24, 2020 at 8:40 pmI have discovered just now that the way to do this is by adding into the script the field:

@Josh: For now, please use the VBScript method (added in the article), which updates the target path, arguments, and the Start in directory automatically.NicoOctober 31, 2022 at 8:58 pmHello. I have created a link to thw vbs script in my Send To folder.
But when running the script by selecting a link file and choosing sendTo it does not work.
VBScript gives an error when running
Script: C:\tmp\script.vbs
Line: 20
Error: file not found
Code: 800A0035A

In the above example, replace "C:\Path\to\Target\Folder" with the actual path of the folder you want to create a shortcut to. Similarly, replace "C:\Path\to\Shortcut.lnk" with the desired path and filename for the shortcut.

This assumes runemacs is on your PATH environment variable. Youcan check it by directly launch runemacs from Windows Run[Win+r]. If failed, search PATH in windows search, then add thepath to runemacs into user's PATH variable.

I am using Ubuntu 20.04 and i have installed a windows application using wineHQ. In windows the desktop icon has two parameters "Start in" and "Target". The "Start in" path points to a network server path and "Target" points to a file on the C drive followed by a network path file. I would like to know how the Ubuntu .desktop file configured to use the the target and start in parameters. See the configurations under;

Nothing special about the shortcuts. You should be able to script it after establishing what you need. (Not sure what tool to use in windows, though, if that is what you are using. Linux shortcuts are text files with the .desktop extension.)

=HYPERLINK("#A1", "Go to cell A1")
Hyperlink to a different workbookTo create a hyperlink to another workbook, you need to specify the full path to the target workbook in the following format:

When you move the files, the relative hyperlink will continue working as long as the relative path to the target workbook remains unchanged. For more information, please see Absolute and relative hyperlinks in Excel.
Hyperlink to a named rangeIf you are making a hyperlink to a worksheet-level name, include the full path to the target name:

In a similar fashion, you can edit the link text (friendly_name) in all Hyperlink formulas at the same time. When doing so, be sure to check that the text to be replaced in friendly_name does not appear anywhere in link_location so that you won't break the formulas.
Excel HYPERLINK not working - reasons and solutionsThe most common reason for a Hyperlink formula not working (and the first thing for you to check!) is a non-existent or broken path in the link_location argument. If it's not the case, check out the following two things:

Adding desktop shortcuts with group policy is very easy to do. With item level targeting you can get very specific on which users the GPO applies to. Helpdesk likes to use this to add a shortcut to the printer share on all users desktop. This makes it easy for end users to install their own printers.

In the shortcut properties dialog box, you can see two tabs: General and Common. The General tab is used to add and modify shortcuts as mentioned in Step 3. The Common tab is used to configure user-level targeting.

PS: By default Windows 10 opens local folders of Documents, Music, Pictures and Videos when you click on their shortcuts in Start Menu. Using the above mentioned steps, you can change them to launch corresponding libraries similar to Windows 7. Just change their path to following values respectively:

The ansible.windows.win_shell module takes the command name followed by a list of space-delimited arguments. It is similar to the ansible.windows.win_command module, but runs the command via a shell (defaults to PowerShell) on the target host.

e2b47a7662
Reply all
Reply to author
Forward
0 new messages