显示\隐藏系统文件及扩展名

往右键中添加"显示\隐藏系统文件及扩展名",是不是觉得很有趣,呵呵,这样就不用总是用手去调啦,一次搞定,永久受益

注:如果贴到记事本上运行的时候报错的话不是代码的问题,是注册表的键值那些行太长啦,写到记事本上的时候可能就换了行了,把那儿改改就可以啦!
 

 
  
  
  
  
  1. Dim WshSHell,FSO  
  2. On Error Resume Next  
  3. Set WshSHell = WScript.CreateObject("WScript.Shell")  
  4. Set FSO = CreateObject("Scripting.FileSystemObject")  
  5. Set WinVer = WshSHell.Environment("Process")  
  6. Set Args = WScript.Arguments  
  7. CloseTime = 5 
  8. FileName = WScript.ScriptName  
  9. FileFullName = WScript.ScriptFullName  
  10. FilePath = FSO.GetParentFolderName(FileFullName)  
  11. InsPath = FSO.GetSpecialFolder(1)  
  12. InsFullName = FSO.BuildPath(InsPath ,FileName)  
  13. Copyright="icyheart" 
  14. InsTitle="显示/隐藏系统文件及扩展名" 
  15. InsAnswer="显示/隐藏系统文件及扩展名" 
  16. RegPath1="HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\SuperHidden\" 
  17. RegValue1="{00000000-0000-0000-0000-000000000012}" 
  18. RegForm1="REG_SZ" 
  19. RegPath2="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\InProcServer32\" 
  20. RegValue2="%SystemRoot%\system32\shdocvw.dll" 
  21. RegForm2="REG_EXPAND_SZ" 
  22. RegPath3="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\InProcServer32\ThreadingModel" 
  23. RegValue3="Apartment" 
  24. RegForm3="REG_SZ" 
  25. RegPath4="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\CLSID" 
  26. RegValue4="{3f454f0e-42ae-4d7c-8ea3-328250d6e272}" 
  27. RegForm4="REG_SZ" 
  28. RegPath5="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\CLSID" 
  29. RegValue5="{13709620-C279-11CE-A49E-444553540000}" 
  30. RegForm5="REG_SZ" 
  31. RegPath6="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\method" 
  32. RegValue6="ShellExecute" 
  33. RegForm6="REG_SZ" 
  34. RegPath7="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\Param1" 
  35. RegValue7 = FileName 
  36. RegForm7="REG_SZ" 
  37. RegPath8="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\" 
  38. RegPath9="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\" 
  39. RegPath10="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\" 
  40. RegPath11="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\command" 
  41. IF FileFullName <> InsFullName then  
  42.     intAnswer = MsgBox("【是】将“"+ InsAnswer +"”加入到右键菜单,"&Chr(10)&Chr(10)&"【否】将“"+ InsAnswer +"”从右键菜单删除。 ", vbQuestion + vbYesNoCancel, "安装 - "+ InsTitle +" - "+ Copyright)  
  43.     If intAnswer = vbYes Then  
  44.         WshSHell.RegWrite RegPath1,RegValue1,RegForm1  
  45.         WshSHell.RegWrite RegPath2,RegValue2,RegForm2  
  46.         WshSHell.RegWrite RegPath3,RegValue3,RegForm3  
  47.         WshSHell.RegWrite RegPath4,RegValue4,RegForm4  
  48.         WshSHell.RegWrite RegPath5,RegValue5,RegForm5  
  49.         WshSHell.RegWrite RegPath6,RegValue6,RegForm6  
  50.         WshSHell.RegWrite RegPath7,RegValue7,RegForm7  
  51.         if WshSHell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden") = 1 then  
  52.             WshSHell.RegWrite RegPath11, "隐藏系统文件及扩展名", "REG_SZ"  
  53.         else  
  54.             WshSHell.RegWrite RegPath11, "显示系统文件及扩展名", "REG_SZ"  
  55.         end if  
  56.         FSO.GetFile(FileFullName).Copy(InsFullName)  
  57.         WshSHell.popup _  
  58.         "添加脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _  
  59.         "添加注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _  
  60.         chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)_  
  61.         , CloseTime, "安装成功 - "+ InsTitle, 0 + 64  
  62.     end if  
  63.     If intAnswer = vbNo Then  
  64.         WshSHell.RegDelete RegPath11  
  65.         WshSHell.RegDelete RegPath7  
  66.         WshSHell.RegDelete RegPath6  
  67.         WshSHell.RegDelete RegPath5  
  68.         WshSHell.RegDelete RegPath9  
  69.         WshSHell.RegDelete RegPath8  
  70.         WshSHell.RegDelete RegPath3  
  71.         WshSHell.RegDelete RegPath2  
  72.         WshSHell.RegDelete RegPath10  
  73.         WshSHell.RegDelete RegPath1  
  74.         FSO.DeleteFile InsFullName  
  75.         WshSHell.popup _  
  76.         "删除脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _  
  77.         "删除注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _  
  78.         chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)_  
  79.         , CloseTime, "卸载成功 - "+ InsTitle , 0 + 64  
  80.     end if  
  81.     If intAnswer = vbCancel Then  
  82.     end if  
  83. ELSE  
  84.     WshSHell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL\CheckedValue", "1", "REG_DWORD"  
  85.     if WshSHell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden") = 1 then  
  86.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "0", "REG_DWORD"  
  87.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "2", "REG_DWORD"  
  88.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "1", "REG_DWORD"  
  89.         WshSHell.RegWrite RegPath11, "显示系统文件及扩展名", "REG_SZ"  
  90.         WshSHell.SendKeys "{F5}+{F10}e"  
  91.     else  
  92.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "1", "REG_DWORD"  
  93.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "1", "REG_DWORD"  
  94.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "0", "REG_DWORD"  
  95.         WshSHell.RegWrite RegPath11, "隐藏系统文件及扩展名", "REG_SZ"  
  96.         WshSHell.SendKeys "{F5}+{F10}e"  
  97.     end if  
  98. END IF  
  99. Set WshSHell = Nothing 
  100. Set FSO = Nothing 
  101. Set Args = Nothing 
  102. WScript.Quit(0) 



---------------------------------------------------------------------------------------------------------------------
如果大家想分开用的话也行:

显示\隐藏文件扩展名:


 

 
  
  
  
  
  1. set wshshell=wscript.createobject("wscript.shell")  
  2. RegPath="HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\command" 
  3. if WshSHell.Regread ("HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL\CheckedValue")=1 then  
  4.     if WshSHell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden") = 1 then  
  5.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden""0""REG_DWORD" 
  6.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden""2""REG_DWORD" 
  7.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt""1""REG_DWORD" 
  8.         WshSHell.RegWrite RegPath, "显示文件扩展名""REG_SZ" 
  9.           
  10.     else  
  11.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden""1""REG_DWORD" 
  12.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden""1""REG_DWORD" 
  13.         WshSHell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt""0""REG_DWORD" 
  14.         WshSHell.RegWrite RegPath, "隐藏文件扩展名""REG_SZ" 
  15.         end if  
  16. END IF 



显示\隐藏系统文件:

 

 
  
  
  
  
  1. Dim WSHShell  
  2. Set WSHShell = WScript.CreateObject("WScript.Shell")  
  3.  
  4. if WSHShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden") = 1 then  
  5.  
  6. WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden""0""REG_DWORD" 
  7. WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden""2""REG_DWORD" 
  8. WshShell.RegWrite "HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\command""显示系统文件""REG_SZ" 
  9. WshShell.SendKeys "{F5}+{F10}e" 
  10.  
  11. else  
  12.  
  13. WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden""1""REG_DWORD" 
  14. WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden""1""REG_DWORD" 
  15. WshShell.RegWrite "HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\command""隐藏系统文件""REG_SZ" 
  16. WshShell.SendKeys "{F5}+{F10}e" 
  17.  
  18. end if  
  19. Set WSHShell = Nothing 
  20. WScript.Quit(0) 

 

本文出自 “乔磊的博客 学习 进步” 博客,请务必保留此出处http://sucre.blog.51cto.com/1084905/394561

你可能感兴趣的:(职场,VBScript,休闲)