set args = WScript.Arguments
linkname = args(0)
set wshshell = CreateObject("WScript.Shell")
set scut = wshshell.CreateShortcut(linkname)
set fs = CreateObject("Scripting.FileSystemObject")
folder = """" & fs.GetParentFolderName(scut.TargetPath) & """"
wshshell.Run(folder)
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


