有时要检视隐藏的档案、副档名时,我们一般总是由资料夹中的功能表,点选
【 工具 】->【 资料夹选项 】-> 【 检视 】的页签
将「隐藏已知档案类型的副档名」、「隐藏保护的作业系统档案」取消勾选
并点选「显示所有档案和资料夹」,再按「确定」。
操作的路径很冗长,想说干脆开着,隐藏档又有碍美观;而显示副档名又让改档名变得麻烦,而隐藏它又修改不到副档名,总是再次做冗长的操作来开开关关.........
不如我们在右键选单加个选项来快速切换。
--------------------------------------------------------------------------------------------------------------
<<<批次档制作编辑>>>
1 新增一个纯文字档*.txt
2 使用"记事本"开启纯文字档来编辑
输入:
复制程式
@echo off
mode con cols=41 lines=4
Title 右键选单 显示/隐藏档案和副档名
color 0b
if not exist "%windir%\ShowFile.vbs" goto setup
reg delete "HKCR\CLSID\{00000000-0000-0000-0000-000000000022}" /f >nul 2>nul
del /f /q "%windir%\ShowFile.vbs" >nul 2>nul
echo.&echo 右键卸除完毕。
pause>nul
exit
:setup
color 0a
>"%windir%\ShowFile.vbs" echo Dim WSHShell
>>"%windir%\ShowFile.vbs" echo Set WSHShell = WScript.CreateObject("WScript.Shell")
>>"%windir%\ShowFile.vbs" echo WSHShell.RegWrite "HKCR\CLSID\{00000000-0000-0000-0000-000000000022}\Instance\InitPropertyBag\CLSID", "{13709620-C279-11CE-A49E-444553540000}", "REG_SZ"
>>"%windir%\ShowFile.vbs" echo WSHShell.RegWrite "HKCR\CLSID\{00000000-0000-0000-0000-000000000022}\Instance\InitPropertyBag\method", "ShellExecute", "REG_SZ"
>>"%windir%\ShowFile.vbs" echo if WSHShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt") = 0 then
>>"%windir%\ShowFile.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "0", "REG_DWORD"
>>"%windir%\ShowFile.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "2", "REG_DWORD"
>>"%windir%\ShowFile.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "1", "REG_DWORD"
>>"%windir%\ShowFile.vbs" echo WSHShell.RegWrite "HKCR\CLSID\{00000000-0000-0000-0000-000000000022}\Instance\InitPropertyBag\command", "显示档案和副档名", "REG_SZ"
>>"%windir%\ShowFile.vbs" echo WSHShell.SendKeys "{F5}+{F10}e"
>>"%windir%\ShowFile.vbs" echo else
>>"%windir%\ShowFile.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "1", "REG_DWORD"
>>"%windir%\ShowFile.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "1", "REG_DWORD"
>>"%windir%\ShowFile.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "0", "REG_DWORD"
>>"%windir%\ShowFile.vbs" echo WSHShell.RegWrite "HKCR\CLSID\{00000000-0000-0000-0000-000000000022}\Instance\InitPropertyBag\command", "隐藏档案和副档名", "REG_SZ"
>>"%windir%\ShowFile.vbs" echo WSHShell.SendKeys "{F5}+{F10}e"
>>"%windir%\ShowFile.vbs" echo end if
>>"%windir%\ShowFile.vbs" echo Set WSHShell = Nothing
>>"%windir%\ShowFile.vbs" echo WScript.Quit(0)
reg export "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "%temp%\__.reg" >nul
for /f "tokens=2 delims==" %%. in ('find/i "HideFileExt" "%temp%\__.reg"') do set v=%%~.
del "%temp%\__.reg"
set v=%v:~-1%
if %v% equ 0 set vv=隐藏档案和副档名
if %v% equ 1 set vv=显示档案和副档名
>"%temp%\_.reg" echo REGEDIT4
>>"%temp%\_.reg" echo [HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\ShowFile]
>>"%temp%\_.reg" echo @="{00000000-0000-0000-0000-000000000022}"
>>"%temp%\_.reg" echo [HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000022}\InProcServer32]
>>"%temp%\_.reg" echo @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,73,\
>>"%temp%\_.reg" echo 68,64,6f,63,76,77,2e,64,6c,6c,00
>>"%temp%\_.reg" echo "ThreadingModel"="Apartment"
>>"%temp%\_.reg" echo [HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000022}\Instance]
>>"%temp%\_.reg" echo "CLSID"="{3f454f0e-42ae-4d7c-8ea3-328250d6e272}"
>>"%temp%\_.reg" echo [HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000022}\Instance\InitPropertyBag]
>>"%temp%\_.reg" echo "method"="ShellExecute"
>>"%temp%\_.reg" echo "Param1"="ShowFile.vbs"
>>"%temp%\_.reg" echo "CLSID"="{13709620-C279-11CE-A49E-444553540000}"
>>"%temp%\_.reg" echo "command"="%vv%"
regedit /s "%temp%\_.reg"
del /f /q "%temp%\_.reg"
echo.&echo 右键已新增 [%vv%] 功能。
pause>nul
exit
3 储存纯文字档。
4 最后~~将纯文字档副档名重命名为bat
例如:Show-Hide_File&Ext.txt 改为 Show-Hide_File&Ext.bat 。
直接执行刚刚的批次档即可
该批次档Show-Hide_File&Ext.bat 可进行 安装/卸除 动作,请保留,当不想要右键功能时,再执行一次批次档即可卸除。