2011年4月28日星期四

右键显示or隐藏系统文件、扩展名

  记不清从那个网站上找到的bat批处理脚本,适用于windows 7、Windows 8系统,Vista、XP系统未测试(Vista应该没问题,XP不好说)。
  与其他在网络上流传的脚本相比,这两个批处理脚本使用简单:直接在批处理文件上右键选择“以管理员身份运行”即可安装/卸载右键菜单。
  首先是添加“显示/隐藏系统文件”右键菜单,复制下面的代码保存为 bat 文件(文件名随便起个喜欢的)。需要注意的是在运行此bat批处理文件前,可能需先在文件夹选项中设置一下是否显示“隐藏文件和文件夹”

@echo off
mode con cols=36 lines=4
title 右键菜单添加删除
color 0A
if not exist "%windir%\SuperHidden.vbs" goto setup
reg delete "HKCR\CLSID\{00000000-0000-0000-0000-000000000012}" /f >nul 2>nul
del /f /q "%windir%\SuperHidden.vbs" >nul 2>nul
echo.&echo 已删除显示/隐藏系统文件!
pause>nul
exit
:setup
color 0A
>"%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\ShowSuperHidden") = 1 then
>>"%windir%\SuperHidden.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "0", "REG_DWORD"
>>"%windir%\SuperHidden.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "2", "REG_DWORD"
>>"%windir%\SuperHidden.vbs" echo WSHShell.SendKeys "{F5}"
>>"%windir%\SuperHidden.vbs" echo else
>>"%windir%\SuperHidden.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "1", "REG_DWORD"
>>"%windir%\SuperHidden.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "1", "REG_DWORD"
>>"%windir%\SuperHidden.vbs" echo WSHShell.SendKeys "{F5}"
>>"%windir%\SuperHidden.vbs" echo end if
>>"%windir%\SuperHidden.vbs" echo Set WSHShell = Nothing
>>"%windir%\SuperHidden.vbs" echo WScript.Quit(0)
>"%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"="显示/隐藏系统文件"
regedit /s "%temp%\_.reg"
del /f /q "%temp%\_.reg"
echo.&echo 右键已添加功能:显示/隐藏系统文件!
pause>nul
exit

  然后是添加“显示/隐藏文件扩展名”,同样复制下面的代码保存为 bat 文件(文件名随便起)。需要显示或隐藏扩展名时,在任意文件上单击右键即可。

@echo off
title 右键添加/删除:显示/隐藏文件扩展名
mode con cols=66 lines=2
color 0A
if not exist %windir%\ext_li.vbs goto setup
del /f /q %windir%\ext_li.vbs >nul 2>nul
reg delete HKCR\*\shell\kzm /f
echo. & echo 删除右键菜单:显示/隐藏文件扩展名,完成!任意键继续。。。
pause >nul
exit
:setup
>"%windir%\ext_li.vbs"  echo Dim WSHShell
>>"%windir%\ext_li.vbs" echo Set WSHShell = WScript.CreateObject("WScript.Shell")
>>"%windir%\ext_li.vbs" echo if WSHShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt") = 1 then
>>"%windir%\ext_li.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "0", "REG_DWORD"
>>"%windir%\ext_li.vbs" echo WSHShell.SendKeys "{F5}"
>>"%windir%\ext_li.vbs" echo else
>>"%windir%\ext_li.vbs" echo WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "1", "REG_DWORD"
>>"%windir%\ext_li.vbs" echo WSHShell.SendKeys "{F5}"
>>"%windir%\ext_li.vbs" echo end if
>>"%windir%\ext_li.vbs" echo Set WSHShell = Nothing
>>"%windir%\ext_li.vbs" echo WScript.Quit(0)
reg add HKCR\*\shell\kzm  /ve /t REG_SZ /d 显示/隐藏文件扩展名 /f >nul
reg add HKCR\*\shell\kzm\command /ve /t REG_SZ /d "wscript %windir%\ext_li.vbs" /f >nul
echo.&echo 右键已添加功能:显示/隐藏文件扩展名!
pause>nul
exit


更新历史
  1. 2014年1月14日更新支持Windows8

0 评论:

发表评论