中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-10-01 13:55
47,813 topics / 349,918 posts / today 0 new / 48,279 members
DOS批处理 & 脚本技术(批处理室) » [Help] How to modify the path of a shortcut
Printable Version  2,117 / 2
Floor1 cad55 Posted 2009-10-17 08:40
高级用户 Posts 329 Credits 620
Want to batch modify the paths of all shortcuts in the current folder through a BAT, as follows:

Original path pointed to by shortcuts:

1、D:\Application Software\cad2004\acad.exe
2、D:\Application Software\asd\a.exe
......

Change their paths through BAT to:

1、E:\Applications\cad2004\acad.exe
2、E:\Applications\asd\a.exe
......

(That is, the drive letter or the previous folder path may change, but the final EXE name remains unchanged)

Please, experts, masters, give me some pointers...

Thank you
Floor2 qinchun36 Posted 2009-10-17 20:50
高级用户 Posts 400 Credits 609
The LNK shortcut is not in text format. I don't know if BAT works. I only know how to modify it with VBSCRIPT.

In order to meet greater flexibility, the modification of the path adopts regular expressions, which can meet more needs.

For example, from D:\Application Software\cad2004\acad.exe to E:\Applications\cad2004\Copy acad.exe

OldPathFormat = "^(D\:\\Application Software\\)(.*\\)(*)$"
NewPathFormat = "E:\Applications\$2\Copy $3"

The following is the code for your requirement.



Attachments
ChangeShortcutTargetPath.zip (1019 bytes)
Floor3 UncleBill Posted 2009-10-17 22:23
新手上路 Posts 10 Credits 12 From 海南
start d:\d\d.exe
Hehe! How nice it is to use this instead of the shortcut
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023