xp添加右键"打开文件所在位置"

时间:2023-03-08 16:06:33
xp添加右键"打开文件所在位置"

以下代码保存为czmb.vbs文件并放在C:\windwos目录下:

Set OS = GetObject("winmgmts:\\.\root\cimv2")
Set CF = OS.ExecQuery("Select * From Win32_ShortcutFile WHERE Name = '" & Replace(WScript.Arguments(0),"\","\\") & "'")
Set WS = WScript.CreateObject("WScript.Shell")
For Each objFile in CF
WS.Run ("explorer /e,/select," & objFile.Target)
Next

以下代码保存为czmb.inf文件,右键点击-安装:

[version]
Signature=$CHICAGO$
[defaultinstall]
addreg=My.add.reg
[My.add.reg]
HKCR,lnkfile\shell\FindTarget,,,"打开文件位置"
HKCR,lnkfile\shell\FindTarget\command,,0x00020000,"%WINDir%\system32\WScript.exe c:\windows\czmb.vbs """%1""""
HKCR,lnkfile\shell\FindTarget\ddeexec\Topic,,,"System"

或者把以下代码保存为reg文件导入注册表也可

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\lnkfile\shell\FindTarget]
@="打开文件位置"

[HKEY_CLASSES_ROOT\lnkfile\shell\FindTarget\command]
@=hex(2):25,00,57,00,49,00,4e,00,44,00,69,00,72,00,25,00,5c,00,73,00,79,00,73,\
00,74,00,65,00,6d,00,33,00,32,00,5c,00,57,00,53,00,63,00,72,00,69,00,70,00,\
74,00,2e,00,65,00,78,00,65,00,20,00,63,00,3a,00,5c,00,77,00,69,00,6e,00,64,\
00,6f,00,77,00,73,00,5c,00,63,00,7a,00,6d,00,62,00,2e,00,76,00,62,00,73,00,\
20,00,22,00,25,00,31,00,22,00,00,00

[HKEY_CLASSES_ROOT\lnkfile\shell\FindTarget\ddeexec]

[HKEY_CLASSES_ROOT\lnkfile\shell\FindTarget\ddeexec\Topic]
@="System"