批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程
[批处理文件精品]批处理版照片整理器[批处理文件精品]纯批处理备份&还原驱动在线第三方下载
返回列表 发帖

[问题求助] 这个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条为啥改不了难道这有毒

you don't have permission possible.

TOP

vbs的权限低,批处理比它高些。

TOP

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

TOP

  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
复制代码

TOP

返回列表