Board logo

标题: [问题求助] 这个VBS为啥改不了注册表,难道这有毒 [打印本页]

作者: smss    时间: 2019-1-9 16:20     标题: 这个VBS为啥改不了注册表,难道这有毒

  1. Dim WSHShell
  2. Set WSHShell = WScript.CreateObject("WScript.Shell")
  3. sTitle1 = "SSH=0"
  4. sTitle2 = "SSH=1"
  5. if WSHShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden") = 1 then
  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 "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "1", "REG_DWORD"
  9. WSHShell.RegWrite "HKEY_CLASSES_ROOT\Directory\Background\shell\show", "显示系统文件+扩展名", "REG_SZ"
  10. WSHShell.SendKeys "{F5}+{F10}"
  11. 'WSHShell.Popup "Poof, they're gone", 1, sTitle1, vbInformation
  12. else
  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 "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "0", "REG_DWORD"
  16. WSHShell.RegWrite "HKEY_CLASSES_ROOT\Directory\Background\shell\show", "隐藏系统文件+扩展名", "REG_SZ"
  17. WSHShell.SendKeys "{F5}+{F10}"
  18. 'WSHShell.Popup "Here they are", 1, sTitle2, vbInformation
  19. end if
  20. Set WSHShell = Nothing
  21. WScript.Quit(0)
复制代码
这个为啥改不了注册表
WSHShell.RegWrite "HKEY_CLASSES_ROOT\Directory\Background\shell\show", "显示系统文件+扩展名", "REG_SZ"
WSHShell.RegWrite "HKEY_CLASSES_ROOT\Directory\Background\shell\show", "隐藏系统文件+扩展名", "REG_SZ"
路径是对的 其它键值可以改 这2条为啥改不了难道这有毒
作者: ivor    时间: 2019-1-9 20:13

you don't have permission possible.
作者: 窄口牛    时间: 2019-1-10 07:02

vbs的权限低,批处理比它高些。
作者: smss    时间: 2019-1-11 21:12

vbs的权限低,批处理比它高些。
窄口牛 发表于 2019-1-10 07:02

WSHShell.run "C:\Windows\1.bat",0
...
WSHShell.run "C:\Windows\2.bat",0
...
1.bat和2.bat中分别写入解决 只是又多了两个BAT

reg add HKEY_CLASSES_ROOT\Directory\Background\shell\show1 /d "显示文件+扩展名" /f

reg add HKEY_CLASSES_ROOT\Directory\Background\shell\show1 /d "隐藏文件+扩展名" /f

有什么法子合成一个Bat让这运行一次就可以切换一次

@Batcher
作者: ivor    时间: 2019-1-11 21:47

  1. reg query HKEY_CLASSES_ROOT\Directory\Background\shell\show1 | find "显示" >nul && reg add HKEY_CLASSES_ROOT\Directory\Background\shell\show1 /d "隐藏文件+扩展名" /f || reg add HKEY_CLASSES_ROOT\Directory\Background\shell\show1 /d "显示文件+扩展名" /f
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2