有時要檢視隱藏的檔案、副檔名時,我們一般總是由資料夾中的功能表,點選
【 工具 】->【 資料夾選項 】-> 【 檢視 】的頁籤
將「隱藏已知檔案類型的副檔名」、「隱藏保護的作業系統檔案」取消勾選
並點選「顯示所有檔案和資料夾」,再按「確定」。
操作的路徑很冗長,想說乾脆開著,隱藏檔又有礙美觀;而顯示副檔名又讓改檔名變得麻煩,而隱藏它又修改不到副檔名,總是再次做冗長的操作來開開關關.........
不如我們在右鍵選單加個選項來快速切換。
--------------------------------------------------------------------------------------------------------------
<<<批次檔製作編輯>>>
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 可進行 安裝/卸除 動作,請保留,當不想要右鍵功能時,再執行一次批次檔即可卸除。