![]() |
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-08-09 09:29 |
47,811 topics / 349,895 posts / today 0 new / 48,253 members |
| DOS批处理 & 脚本技术(批处理室) » [Resolved] The Difficulty of Batch Creating and Modifying Shortcuts with Shortcuts |
| Printable Version 1,933 / 9 |
| Floor1 HUNRYBECKY | Posted 2008-07-31 14:46 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
Combined with batch processing, shortcuts can be used to create and modify shortcuts in batches. But in practice, a problem is encountered. That is, if there are paths with spaces in the /P parameter or /W parameter or /I parameter when creating or modifying shortcuts with shortcuts, the creation of the shortcut will fail. And if there are spaces in the path of the shortcut parameter, it itself requires that the path be enclosed in quotes, thus causing a conflict. How to solve this problem? For example, a shortcut with the target "D:\UGS\NX 6.0\MACH\auxiliary\cls2clf.bat", the parameter "D:\UGS\NX 6.0\", the working path "D:\UGS\NX 6.0\MACH\auxiliary\", and the icon "D:\UGS\NX 6.0\UGTO2D\ugto2d.ico,0" will fail when created with shortcuts.
The following is the batch file and the shortcut I packaged. Please test how to solve this problem. The BS in the following program is a character replacement tool to replace any specified characters. [ Last edited by HUNRYBECKY on 2008-8-4 at 08:23 AM ] Attachments SCUT.rar (108.6 KiB) |
|
| Floor2 HUNRYBECKY | Posted 2008-07-31 15:55 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
No one answered, so I'll bump it up myself.
|
|
| Floor3 HUNRYBECKY | Posted 2008-07-31 16:10 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
Hehe, why are all the experts lurking today. Still waiting.
|
|
| Floor4 moniuming | Posted 2008-07-31 16:25 |
| 银牌会员 Posts 574 Credits 1,335 From 广西 | |
| Floor5 HUNRYBECKY | Posted 2008-08-01 14:13 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
Experts are really good at lurking, and no one has visited yet.
|
|
| Floor6 HUNRYBECKY | Posted 2008-08-02 12:07 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
I'll give it a bump myself. I don't know if this question is too simple or for some other reason, but居然 no one has answered...
|
|
| Floor7 dato | Posted 2008-08-02 13:26 |
| 高级用户 Posts 377 Credits 916 | |
|
I don't know if this VBS supports spaces, but in some cases I'd rather create a .lnk file and release it directly using the copy method, package it with iexpress, and execute it with psexec. Scripts can be annoying with a bunch of ABCs sometimes
|
|
| Floor8 HUNRYBECKY | Posted 2008-08-02 14:07 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
Thanks dato, this VBS script also can't achieve special paths with parameters. The COPY method can't achieve what I requested because I automatically replace the corresponding paths according to the software installation directory. Because some software needs to create a large number of shortcuts. If I first use RAR to compress and then automatically unpack to the corresponding path, if the extraction directory is the same as the source installation directory, then automatically skip; if not the same, then use the SHORTCUT command to automatically replace the corresponding path.
|
|
| Floor9 HUNRYBECKY | Posted 2008-08-02 17:37 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
I've tried using WINRAR to pack, but I still can't create this special parameter shortcut. Really disappointed.
|
|
| Floor10 HUNRYBECKY | Posted 2008-08-04 08:23 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
The problem has been completely solved. After searching frantically on foreign websites, I found that shortcut has a special escape character \, heh. To keep the double quotes ", you just need to add \ in front of it. Since I found that some shortcut paths also have a \ symbol later, such as "D:\UGS\", these might cause conflicts, so the batch processing below made corresponding treatments to avoid this situation. After testing, it can completely and correctly handle shortcuts with many complex parameters.
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |