baomaboy
银牌会员
积分 1513
发帖 554
注册 2005-12-30
状态 离线
|
『楼 主』:
[原创]隐藏/显示磁盘→VBS版
原理简单的要命,属于N年以前的那个时代。
Quote: | '*****************************************************************************
' FileName: DiskHidden.VBS
' Author: baomaboy
' Abstract: 隐藏/显示系统磁盘
'*****************************************************************************
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="玲珑科技"
QQ="QQ:25926183"
Email="Email:25926183@qq.com"
InsTitle="隐藏/显示系统磁盘"
InsAnswer="隐藏/显示系统磁盘"
RegPath1="HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\shell\DiskHidden\"
RegValue1="显示所有系统磁盘"
RegForm1="REG_SZ"
RegPath2="HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\shell\DiskHidden\command\"
RegValue2="wscript.exe """& InsFullName &""" ""%L"""
RegPath3="HKEY_CLASSES_ROOT\Drive\shell\DiskHidden\"
RegValue3="隐藏这个系统磁盘"
RegPath4="HKEY_CLASSES_ROOT\Drive\shell\DiskHidden\command\"
IF FileFullName <> InsFullName then
intAnswer = MsgBox("【是】将“隐藏/显示系统磁盘”加入到右键菜单,"&Chr(10)&Chr(10)&"【否】将“隐藏/显示系统磁盘”从右键菜单删除。 ", vbQuestion + vbYesNoCancel, "安装 - "+ InsTitle +" - by baomaboy")
If intAnswer = vbYes Then
WshSHell.RegWrite RegPath1,RegValue1,RegForm1
WshSHell.RegWrite RegPath2,RegValue2,RegForm1
WshSHell.RegWrite RegPath3,RegValue3,RegForm1
WshSHell.RegWrite RegPath4,RegValue2,RegForm1
FSO.GetFile(FileFullName).Copy(InsFullName)
WshSHell.popup _
"添加脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
"添加注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+chr(34)+ RegPath3 +chr(34)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _
, CloseTime, "安装成功 - "+ InsTitle +" - by baomaboy", 0 + 64
end if
If intAnswer = vbNo Then
WshSHell.RegDelete RegPath4
WshSHell.RegDelete RegPath3
WshSHell.RegDelete RegPath2
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(34)+ RegPath3 +chr(34)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _
, CloseTime, "卸载成功 - "+ InsTitle +" - by baomaboy", 0 + 64
end if
If intAnswer = vbCancel Then
end if
Else
TemNumber = "1"
DiskNameStr="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
For i = 1 to 26
if i > 1 then TemNumber = TemNumber * 2
DiskTryStr=mid(DiskNameStr,i,1)
if Ucase(Left(Args(0),1)) = DiskTryStr then exit for
Next
RegNumber = WshSHell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDrives")
if RegNumber > 0 then TemNumber = TemNumber + RegNumber
if Args(0) = "" then
TemNumber = 0
insmm=Inputbox(""&chr(10)&chr(10)&"请输入密码:(3-8位的数字)","请输入密码 - 显示所有磁盘")
if insmm <> chr(50)&chr(53)&chr(57)&chr(50)&chr(54)&chr(49)&chr(56)&chr(51) then WScript.Quit(0)'''还是加个密码吧(哪怕是形同虚设)
end if
WshSHell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDrives",TemNumber,"REG_DWORD"
WshSHell.Run("gpupdate /force /wait:0"),0,0
WshSHell.Run("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters"),0,0
WScript.Sleep 2000
WshSHell.SendKeys "{F5}+{F10}e"
End If
Set WshSHell = Nothing
Set FSO = Nothing
Set Args = Nothing
WScript.Quit(0) |
|
此帖被 +4 点积分 点击查看详情 评分人:【 HAT 】 | 分数: +4 | 时间:2009-3-6 23:45 |
|
|
好多菩提树,好多明镜台。本来好多物,好多的尘埃。 |
|