往右键中添加"显示\隐藏系统文件及扩展名",是不是觉得很有趣,呵呵,这样就不用总是用手去调啦,一次搞定,永久受益
注:如果贴到记事本上运行的时候报错的话不是代码的问题,是注册表的键值那些行太长啦,写到记事本上的时候可能就换了行了,把那儿改改就可以啦!
Dim WshSHell,FSO On Error Resume Next Set WshSHell = WScript.CreateObject("WScript.Shell") Set FSO = CreateObject("Scripting.FileSystemObject") Set WinVer = WshSHell.Environment("Process") Set Args = WScript.Arguments CloseTime = 5 FileName = WScript.ScriptName FileFullName = WScript.ScriptFullName FilePath = FSO.GetParentFolderName(FileFullName) InsPath = FSO.GetSpecialFolder(1) InsFullName = FSO.BuildPath(InsPath ,FileName) Copyright="icyheart" InsTitle="显示/隐藏系统文件及扩展名" InsAnswer="显示/隐藏系统文件及扩展名" RegPath1="HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\SuperHidden\" RegValue1="{00000000-0000-0000-0000-000000000012}" RegForm1="REG_SZ" RegPath2="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\InProcServer32\" RegValue2="%SystemRoot%\system32\shdocvw.dll" RegForm2="REG_EXPAND_SZ" RegPath3="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\InProcServer32\ThreadingModel" RegValue3="Apartment" RegForm3="REG_SZ" RegPath4="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\CLSID" RegValue4="{3f454f0e-42ae-4d7c-8ea3-328250d6e272}" RegForm4="REG_SZ" RegPath5="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\CLSID" RegValue5="{13709620-C279-11CE-A49E-444553540000}" RegForm5="REG_SZ" RegPath6="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\method" RegValue6="ShellExecute" RegForm6="REG_SZ" RegPath7="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\Param1" RegValue7 = FileName RegForm7="REG_SZ" RegPath8="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\" RegPath9="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\" RegPath10="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\" RegPath11="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\command" IF FileFullName <> InsFullName then intAnswer = MsgBox("【是】将“"+ InsAnswer +"”加入到右键菜单,"&Chr(10)&Chr(10)&"【否】将“"+ InsAnswer +"”从右键菜单删除。 ", vbQuestion + vbYesNoCancel, "安装 - "+ InsTitle +" - "+ Copyright) If intAnswer = vbYes Then WshSHell.RegWrite RegPath1,RegValue1,RegForm1 WshSHell.RegWrite RegPath2,RegValue2,RegForm2 WshSHell.RegWrite RegPath3,RegValue3,RegForm3 WshSHell.RegWrite RegPath4,RegValue4,RegForm4 WshSHell.RegWrite RegPath5,RegValue5,RegForm5 WshSHell.RegWrite RegPath6,RegValue6,RegForm6 WshSHell.RegWrite RegPath7,RegValue7,RegForm7 if WshSHell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden") = 1 then WshSHell.RegWrite RegPath11, "隐藏系统文件及扩展名", "REG_SZ" else WshSHell.RegWrite RegPath11, "显示系统文件及扩展名", "REG_SZ" end if FSO.GetFile(FileFullName).Copy(InsFullName) WshSHell.popup _ "添加脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _ "添加注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _ chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)_ , CloseTime, "安装成功 - "+ InsTitle, 0 + 64 end if If intAnswer = vbNo Then WshSHell.RegDelete RegPath11 WshSHell.RegDelete RegPath7 WshSHell.RegDelete RegPath6 WshSHell.RegDelete RegPath5 WshSHell.RegDelete RegPath9 WshSHell.RegDelete RegPath8 WshSHell.RegDelete RegPath3 WshSHell.RegDelete RegPath2 WshSHell.RegDelete RegPath10 WshSHell.RegDelete RegPath1 FSO.DeleteFile InsFullName WshSHell.popup _ "删除脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _ "删除注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _ chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)_ , CloseTime, "卸载成功 - "+ InsTitle , 0 + 64 end if If intAnswer = vbCancel Then end if ELSE WshSHell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL\CheckedValue", "1", "REG_DWORD" if WshSHell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden") = 1 then WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "0", "REG_DWORD" WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "2", "REG_DWORD" WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "1", "REG_DWORD" WshSHell.RegWrite RegPath11, "显示系统文件及扩展名", "REG_SZ" WshSHell.SendKeys "{F5}+{F10}e" else WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "1", "REG_DWORD" WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "1", "REG_DWORD" WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "0", "REG_DWORD" WshSHell.RegWrite RegPath11, "隐藏系统文件及扩展名", "REG_SZ" WshSHell.SendKeys "{F5}+{F10}e" end if END IF Set WshSHell = Nothing Set FSO = Nothing Set Args = Nothing WScript.Quit(0)
---------------------------------------------------------------------------------------------------------------------
如果大家想分开用的话也行:
显示\隐藏文件扩展名:
set wshshell=wscript.createobject("wscript.shell") RegPath="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\command" if WshSHell.Regread ("HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL\CheckedValue")=1 then if WshSHell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden") = 1 then WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "0", "REG_DWORD" WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "2", "REG_DWORD" WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "1", "REG_DWORD" WshSHell.RegWrite RegPath, "显示文件扩展名", "REG_SZ" else WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "1", "REG_DWORD" WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "1", "REG_DWORD" WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "0", "REG_DWORD" WshSHell.RegWrite RegPath, "隐藏文件扩展名", "REG_SZ" end if END IF
显示\隐藏系统文件:
Dim WSHShell Set WSHShell = WScript.CreateObject("WScript.Shell") if WSHShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden") = 1 then WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "0", "REG_DWORD" WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "2", "REG_DWORD" WshShell.RegWrite "HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\command", "显示系统文件", "REG_SZ" WshShell.SendKeys "{F5}+{F10}e" else WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "1", "REG_DWORD" WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "1", "REG_DWORD" WshShell.RegWrite "HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\command", "隐藏系统文件", "REG_SZ" WshShell.SendKeys "{F5}+{F10}e" end if Set WSHShell = Nothing WScript.Quit(0)
本文出自 “乔磊的博客 学习 进步” 博客,请务必保留此出处http://sucre.blog.51cto.com/1084905/394561