右键显示(隐藏)扩展名的bat代码
程序员文章站
2022-03-22 09:40:09
“显示/隐藏 系统文件”需右键单击任意文件夹或文件才能显示菜单 “显示/隐藏 扩展名”需右键单击任意文件夹里的空白处才能显示菜单 右键显示(隐藏)扩展名及系统文件.bat复...
“显示/隐藏 系统文件”需右键单击任意文件夹或文件才能显示菜单
“显示/隐藏 扩展名”需右键单击任意文件夹里的空白处才能显示菜单
右键显示(隐藏)扩展名及系统文件.bat
@echo off
reg delete "hkcr\clsid\{00000000-0000-0000-0000-000000000012}" /f >nul 2>nul
reg delete "hklm\software\classes\*\shell\displayfileext" /f >nul 2>nul
reg delete "hklm\software\classes\folder\shell\displayfileext" /f >nul 2>nul
del /f /q "%windir%\superhidden.vbs" "%windir%\superhidden1.vbs" >nul 2>nul
>"%windir%\superhidden.vbs" echo dim wshshell
>>"%windir%\superhidden.vbs" echo set wshshell = wscript.createobject("wscript.shell")
>>"%windir%\superhidden.vbs" echo if wshshell.regread("hkcu\software\microsoft\windows\currentversion\explorer\advanced\hidefileext") = 0 then
>>"%windir%\superhidden.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\hidefileext", "1", "reg_dword"
>>"%windir%\superhidden.vbs" echo wshshell.regwrite "hkcr\clsid\{00000000-0000-0000-0000-000000000012}\instance\initpropertybag\command", "显示扩展名", "reg_sz"
>>"%windir%\superhidden.vbs" echo wshshell.sendkeys "{f5}+{f10}e"
>>"%windir%\superhidden.vbs" echo else
>>"%windir%\superhidden.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\hidefileext", "0", "reg_dword"
>>"%windir%\superhidden.vbs" echo wshshell.regwrite "hkcr\clsid\{00000000-0000-0000-0000-000000000012}\instance\initpropertybag\command", "隐藏扩展名", "reg_sz"
>>"%windir%\superhidden.vbs" echo wshshell.sendkeys "{f5}+{f10}e"
>>"%windir%\superhidden.vbs" echo end if
>>"%windir%\superhidden.vbs" echo set wshshell = nothing
>>"%windir%\superhidden.vbs" echo wscript.quit(0)
>"%windir%\superhidden1.vbs" echo dim wshshell
>>"%windir%\superhidden1.vbs" echo set wshshell = wscript.createobject("wscript.shell")
>>"%windir%\superhidden1.vbs" echo stitle1 = "ssh=0"
>>"%windir%\superhidden1.vbs" echo stitle2 = "ssh=1"
>>"%windir%\superhidden1.vbs" echo if wshshell.regread("hkcu\software\microsoft\windows\currentversion\explorer\advanced\showsuperhidden") = 1 then
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\showsuperhidden", "0", "reg_dword"
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\hidden", "2", "reg_dword"
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcr\clsid\{00000000-0000-0000-0000-000000000012}\instance\initpropertybag\command", "显示扩展名", "reg_sz"
>>"%windir%\superhidden1.vbs" echo wshshell.sendkeys "{f5}+{f10}e"
>>"%windir%\superhidden1.vbs" echo 'wshshell.popup "poof, they're gone!", 1, stitle1, vbinformation
>>"%windir%\superhidden1.vbs" echo else
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\showsuperhidden", "1", "reg_dword"
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\hidden", "1", "reg_dword"
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcr\clsid\{00000000-0000-0000-0000-000000000012}\instance\initpropertybag\command", "显示扩展名", "reg_sz"
>>"%windir%\superhidden1.vbs" echo wshshell.sendkeys "{f5}+{f10}e"
>>"%windir%\superhidden1.vbs" echo 'wshshell.popup "here they are!", 1, stitle2, vbinformation
>>"%windir%\superhidden1.vbs" echo end if
>>"%windir%\superhidden1.vbs" echo set wshshell = nothing
>>"%windir%\superhidden1.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\superhidden]
>>"%temp%\_.reg" echo @="{00000000-0000-0000-0000-000000000012}"
>>"%temp%\_.reg" echo [hkey_classes_root\clsid\{00000000-0000-0000-0000-000000000012}\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-000000000012}\instance]
>>"%temp%\_.reg" echo "clsid"="{3f454f0e-42ae-4d7c-8ea3-328250d6e272}"
>>"%temp%\_.reg" echo [hkey_classes_root\clsid\{00000000-0000-0000-0000-000000000012}\instance\initpropertybag]
>>"%temp%\_.reg" echo "method"="shellexecute"
>>"%temp%\_.reg" echo "param1"="superhidden.vbs"
>>"%temp%\_.reg" echo "clsid"="{13709620-c279-11ce-a49e-444553540000}"
>>"%temp%\_.reg" echo "command"="%vv%"
>>"%temp%\_.reg" echo [hkey_local_machine\software\classes\*\shell\displayfileext]
>>"%temp%\_.reg" echo @="显示/隐藏 系统文件"
>>"%temp%\_.reg" echo [hkey_local_machine\software\classes\*\shell\displayfileext\command]
>>"%temp%\_.reg" echo @="wscript.exe c:\\windows\\superhidden1.vbs"
>>"%temp%\_.reg" echo [hkey_local_machine\software\classes\folder\shell\displayfileext]
>>"%temp%\_.reg" echo @="显示/隐藏 系统文件"
>>"%temp%\_.reg" echo [hkey_local_machine\software\classes\folder\shell\displayfileext\command]
>>"%temp%\_.reg" echo @="wscript.exe c:\\windows\\superhidden1.vbs"
regedit /s "%temp%\_.reg"
del /f /q "%temp%\_.reg"
exit
右键恢复原样.bat
@echo off
reg delete "hkcr\clsid\{00000000-0000-0000-0000-000000000012}" /f >nul 2>nul
reg delete "hklm\software\classes\*\shell\displayfileext" /f >nul 2>nul
reg delete "hklm\software\classes\folder\shell\displayfileext" /f >nul 2>nul
del /f /q "%windir%\superhidden.vbs" "%windir%\superhidden1.vbs" >nul 2>nul
“显示/隐藏 扩展名”需右键单击任意文件夹里的空白处才能显示菜单
右键显示(隐藏)扩展名及系统文件.bat
复制代码 代码如下:
@echo off
reg delete "hkcr\clsid\{00000000-0000-0000-0000-000000000012}" /f >nul 2>nul
reg delete "hklm\software\classes\*\shell\displayfileext" /f >nul 2>nul
reg delete "hklm\software\classes\folder\shell\displayfileext" /f >nul 2>nul
del /f /q "%windir%\superhidden.vbs" "%windir%\superhidden1.vbs" >nul 2>nul
>"%windir%\superhidden.vbs" echo dim wshshell
>>"%windir%\superhidden.vbs" echo set wshshell = wscript.createobject("wscript.shell")
>>"%windir%\superhidden.vbs" echo if wshshell.regread("hkcu\software\microsoft\windows\currentversion\explorer\advanced\hidefileext") = 0 then
>>"%windir%\superhidden.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\hidefileext", "1", "reg_dword"
>>"%windir%\superhidden.vbs" echo wshshell.regwrite "hkcr\clsid\{00000000-0000-0000-0000-000000000012}\instance\initpropertybag\command", "显示扩展名", "reg_sz"
>>"%windir%\superhidden.vbs" echo wshshell.sendkeys "{f5}+{f10}e"
>>"%windir%\superhidden.vbs" echo else
>>"%windir%\superhidden.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\hidefileext", "0", "reg_dword"
>>"%windir%\superhidden.vbs" echo wshshell.regwrite "hkcr\clsid\{00000000-0000-0000-0000-000000000012}\instance\initpropertybag\command", "隐藏扩展名", "reg_sz"
>>"%windir%\superhidden.vbs" echo wshshell.sendkeys "{f5}+{f10}e"
>>"%windir%\superhidden.vbs" echo end if
>>"%windir%\superhidden.vbs" echo set wshshell = nothing
>>"%windir%\superhidden.vbs" echo wscript.quit(0)
>"%windir%\superhidden1.vbs" echo dim wshshell
>>"%windir%\superhidden1.vbs" echo set wshshell = wscript.createobject("wscript.shell")
>>"%windir%\superhidden1.vbs" echo stitle1 = "ssh=0"
>>"%windir%\superhidden1.vbs" echo stitle2 = "ssh=1"
>>"%windir%\superhidden1.vbs" echo if wshshell.regread("hkcu\software\microsoft\windows\currentversion\explorer\advanced\showsuperhidden") = 1 then
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\showsuperhidden", "0", "reg_dword"
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\hidden", "2", "reg_dword"
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcr\clsid\{00000000-0000-0000-0000-000000000012}\instance\initpropertybag\command", "显示扩展名", "reg_sz"
>>"%windir%\superhidden1.vbs" echo wshshell.sendkeys "{f5}+{f10}e"
>>"%windir%\superhidden1.vbs" echo 'wshshell.popup "poof, they're gone!", 1, stitle1, vbinformation
>>"%windir%\superhidden1.vbs" echo else
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\showsuperhidden", "1", "reg_dword"
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcu\software\microsoft\windows\currentversion\explorer\advanced\hidden", "1", "reg_dword"
>>"%windir%\superhidden1.vbs" echo wshshell.regwrite "hkcr\clsid\{00000000-0000-0000-0000-000000000012}\instance\initpropertybag\command", "显示扩展名", "reg_sz"
>>"%windir%\superhidden1.vbs" echo wshshell.sendkeys "{f5}+{f10}e"
>>"%windir%\superhidden1.vbs" echo 'wshshell.popup "here they are!", 1, stitle2, vbinformation
>>"%windir%\superhidden1.vbs" echo end if
>>"%windir%\superhidden1.vbs" echo set wshshell = nothing
>>"%windir%\superhidden1.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\superhidden]
>>"%temp%\_.reg" echo @="{00000000-0000-0000-0000-000000000012}"
>>"%temp%\_.reg" echo [hkey_classes_root\clsid\{00000000-0000-0000-0000-000000000012}\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-000000000012}\instance]
>>"%temp%\_.reg" echo "clsid"="{3f454f0e-42ae-4d7c-8ea3-328250d6e272}"
>>"%temp%\_.reg" echo [hkey_classes_root\clsid\{00000000-0000-0000-0000-000000000012}\instance\initpropertybag]
>>"%temp%\_.reg" echo "method"="shellexecute"
>>"%temp%\_.reg" echo "param1"="superhidden.vbs"
>>"%temp%\_.reg" echo "clsid"="{13709620-c279-11ce-a49e-444553540000}"
>>"%temp%\_.reg" echo "command"="%vv%"
>>"%temp%\_.reg" echo [hkey_local_machine\software\classes\*\shell\displayfileext]
>>"%temp%\_.reg" echo @="显示/隐藏 系统文件"
>>"%temp%\_.reg" echo [hkey_local_machine\software\classes\*\shell\displayfileext\command]
>>"%temp%\_.reg" echo @="wscript.exe c:\\windows\\superhidden1.vbs"
>>"%temp%\_.reg" echo [hkey_local_machine\software\classes\folder\shell\displayfileext]
>>"%temp%\_.reg" echo @="显示/隐藏 系统文件"
>>"%temp%\_.reg" echo [hkey_local_machine\software\classes\folder\shell\displayfileext\command]
>>"%temp%\_.reg" echo @="wscript.exe c:\\windows\\superhidden1.vbs"
regedit /s "%temp%\_.reg"
del /f /q "%temp%\_.reg"
exit
右键恢复原样.bat
复制代码 代码如下:
@echo off
reg delete "hkcr\clsid\{00000000-0000-0000-0000-000000000012}" /f >nul 2>nul
reg delete "hklm\software\classes\*\shell\displayfileext" /f >nul 2>nul
reg delete "hklm\software\classes\folder\shell\displayfileext" /f >nul 2>nul
del /f /q "%windir%\superhidden.vbs" "%windir%\superhidden1.vbs" >nul 2>nul