![]() |
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-12 07:57 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » [Completed] Help me correct the VBS code to open the location of the shortcut |
| Printable Version 2,662 / 25 |
| Floor1 kidzgy | Posted 2009-07-29 05:32 |
| 中级用户 Posts 129 Credits 262 | |
|
This is a VBScript code. There is a BUG in it. The attached file is the installation and uninstallation BAT, which includes the VBScript code. This is a program to add the right-click "Open containing folder" to a shortcut. The function is to open the corresponding directory of the shortcut when right-clicking. It is similar to Right-click Properties - Find Target, but the difference is that you don't need to view the properties, and Find Target selects the target, while Open containing folder directly opens the corresponding folder of the shortcut without selecting the target. The problem I raised is that there is a BUG when this VBS runs. In fact, this VBS is widely spread on the Internet. I accidentally discovered it and hope brothers can solve the problem and fix the BUG to improve the program. For example: I have a Maxthon shortcut on the desktop, and the corresponding program is E:\Maxthon\Maxthon.exe If there is also the program E:\Maxthon.exe (that is, the file maxthon.exe exists in the E drive) Then when right-clicking the maxthon to open the containing folder, it is running E:\Maxthon.exe. Of course, if there is no E:\Maxthon.exe, the function can be realized. This is the BUG. Hope everyone can fix it, so that even if the file E:\Maxthon.exe exists, it can still enter the corresponding folder of the shortcut normally. [ Last edited by kidzgy on 2009-8-7 at 08:56 ] Attachments 打开所在位置插件.rar (1.25 KiB) |
|
| Floor2 tireless | Posted 2009-07-29 12:29 |
| 银牌会员 Posts 1,122 Credits 2,025 | |
| Floor3 kidzgy | Posted 2009-07-29 20:36 |
| 中级用户 Posts 129 Credits 262 | |
|
Thank you very much for your code. Your function is exactly equivalent to finding the target.
And what I need is to open the path where the shortcut is located without selecting the target, just like clicking the mouse once. There is the "Find Target", what I want is not, and it is best to maximize the window. |
|
| Floor4 slore | Posted 2009-07-31 07:11 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
Sweat~
Combine below... wshshell.Run(folder) changed to wshshell.Run("explorer " & folder) |
|
| Floor5 kidzgy | Posted 2009-07-31 08:55 |
| 中级用户 Posts 129 Credits 262 | |
|
Wow, no way, it's that simple.
Thanks a lot. Then the new code is |
|
| Floor6 slore | Posted 2009-07-31 09:09 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
I don't know what benefits there are if it's not selected...
|
|
| Floor7 kidzgy | Posted 2009-08-01 07:58 |
| 中级用户 Posts 129 Credits 262 | |
|
It's like this. If there are a lot of files in a folder and you select one, it will go to that file, but the scroll bar is not at the top. If you don't select, it's like double-clicking the folder and just entering, which is a faster way to browse.
|
|
| Floor8 kidzgy | Posted 2009-08-04 08:39 |
| 中级用户 Posts 129 Credits 262 | |
|
By the way, a new problem has emerged. When there are double quotes at the beginning and end of the "Target" and "Start in" properties of the shortcut, the location cannot be opened. Then, how should this be solved?
|
|
| Floor9 slore | Posted 2009-08-04 09:37 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
folder = """" & fs.GetParentFolderName(scut.TargetPath) & """"
Because you added it again... First, check if there are quotes already. If not, add them |
|
| Floor10 kidzgy | Posted 2009-08-04 21:15 |
| 中级用户 Posts 129 Credits 262 | |
|
The code modified by floor 5 pops up such a prompt. Then how to modify it?
![]() [ Last edited by kidzgy on 2009-8-6 at 08:18 ] |
|
| Floor11 kidzgy | Posted 2009-08-04 21:16 |
| 中级用户 Posts 129 Credits 262 | |
|
I tried to subtract one double quote or two from both the beginning and the end as you said, but it didn't work, and there's still such a prompt.
|
|
| Floor12 slore | Posted 2009-08-05 01:39 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
wshshell.Run(folder)
Before msgbox folder you'll know your modification is wrong |
|
| Floor13 kidzgy | Posted 2009-08-05 05:46 |
| 中级用户 Posts 129 Credits 262 | |
|
After I added the msgbox folder, running without double quotes pops up with double quotes at the beginning and end.
But running with double quotes at the beginning and end is still the prompt from post 10. The reason might be ending with.lnk or.url. Thus, the problem is how to make VBS support shortcuts with double quotes. ![]() [ Last edited by kidzgy on 2009-8-6 at 08:20 ] |
|
| Floor14 slore | Posted 2009-08-05 07:45 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
Don't add quotation marks to the ones that already have quotation marks...
|
|
| Floor15 kidzgy | Posted 2009-08-05 08:19 |
| 中级用户 Posts 129 Credits 262 | |
|
Please provide the content that needs to be translated, including the Chinese text and any relevant code blocks if applicable. Currently, the input only has the Chinese request without the specific code or content from the 5th floor that needs to be translated. Please provide the full relevant content for translation.
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |