|
用vbs写了一个,XP/PE自己测试均可用。
Dim WshShell,SysDir,VbsPath
set WshShell = WScript.CreateObject("WScript.shell")
SysRootDir = WshShell.ExpandEnvironmentStrings("%windir%")&"\system32\"
VbsPath=left(Wscript.ScriptFullName,len(Wscript.ScriptFullName)-len(Wscript.ScriptName))
StrShow = "显示系统文件+扩展名"
StrHide = "隐藏系统文件+扩展名"
StrReg = "{bd7ef628-3459-45d0-b81e-f11a4f58c2a3}"
DirReg0 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden"
DirReg1 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden"
DirReg2 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt"
DirReg3 = "HKLM\SOFTWARE\Classes\CLSID\"&StrReg
DirReg4 = "HKCR\Directory\Background\shellex\ContextMenuHandlers\SuperHidden"
if VbsPath = SysRootDir Then
ShoworHide
else
Setupvbs
end if
Function ShoworHide( )
if WSHShell.RegRead(DirReg1) = 1 Then
WSHShell.RegWrite DirReg0, "0", "REG_DWORD"
WSHShell.RegWrite DirReg1, "2", "REG_DWORD"
WSHShell.RegWrite DirReg2, "1", "REG_DWORD"
WshShell.RegWrite DirReg3&"\Instance\InitPropertyBag\command", StrShow, "REG_SZ"
WshShell.SendKeys "{F5}+{F10}e"
else
WSHShell.RegWrite DirReg0, "1", "REG_DWORD"
WSHShell.RegWrite DirReg1, "1", "REG_DWORD"
WSHShell.RegWrite DirReg2, "0", "REG_DWORD"
WshShell.RegWrite DirReg3&"\Instance\InitPropertyBag\command", StrHide, "REG_SZ"
WshShell.SendKeys "{F5}+{F10}e"
end if
Set WSHShell = Nothing
WScript.Quit(0)
End Function
Function Setupvbs( )
if WSHShell.RegRead(DirReg1) = 2 Then
StrShow1 = StrShow
else StrShow1 = StrHide
end if
intAnswer = MsgBox("【是】将“显示/隐藏系统文件+扩展名”加入到右键菜单。 "&Chr(10)&Chr(10)&"【否】将“显示/隐藏系统文件+扩展名”从右键菜单删除。 "&Chr(10)&Chr(10)&"【取消】将直接“"&StrShow1&"”并退出。 ", vbQuestion + vbYesNoCancel, "显示/隐藏系统文件+扩展名")
If intAnswer = vbYes Then
WshShell.RegWrite DirReg4&"\",StrReg,"REG_SZ"
WshShell.RegWrite DirReg3&"\InProcServer32\",SysRootDir&"shdocvw.dll" ,"REG_EXPAND_SZ"
WshShell.RegWrite DirReg3&"\InProcServer32\ThreadingModel","Apartment","REG_SZ"
WshShell.RegWrite DirReg3&"\Instance\CLSID","{3f454f0e-42ae-4d7c-8ea3-328250d6e272}","REG_SZ"
WshShell.RegWrite DirReg3&"\Instance\InitPropertyBag\CLSID","{13709620-C279-11CE-A49E-444553540000}","REG_SZ"
WshShell.RegWrite DirReg3&"\Instance\InitPropertyBag\command",StrShow1,"REG_SZ"
WshShell.RegWrite DirReg3&"\Instance\InitPropertyBag\method","ShellExecute","REG_SZ"
WshShell.RegWrite DirReg3&"\Instance\InitPropertyBag\Param1",SysRootDir&"ShoworHide.vbs","REG_SZ"
set copy1=createobject("scripting.filesystemobject")
copy1.getfile(wscript.scriptfullname).copy SysRootDir&"ShoworHide.vbs",true
end if
If intAnswer = vbNo Then
WshShell.Run "cmd /c reg delete "&DirReg3&" /f",vbhide
WshShell.Run "cmd /c reg delete "&DirReg4&" /f",vbhide
WshShell.Run "cmd /c reg delete "&DirReg0&" /v ShowSuperHidden /f",vbhide
WshShell.Run "cmd /c DEL /F /AS /Q "&SysRootDir&"ShoworHide.vbs",vbhide
end if
If intAnswer = vbCancel Then
ShoworHide
end if
Set WSHShell = Nothing
WScript.Quit(0)
End Function |
|