hta编写的常用工具箱(常用工具快捷方式等)
(编辑:jimmy 日期: 2024/11/2 浏览:3 次 )
一、程序功能简介:
程序基于vbs+hta编写。xp系统下(不同显示器、分辨率)测试通过。
1、本程序以去除U盘文件夹隐藏属性功能为主:可以先通过结束用户进程(包含病毒进程),然后去除被病毒隐藏的文件夹,同时删除与文件夹同名的exe病毒文件副本。
2、辅助功能:
①添加常用命令,如:打开输入法设置、声音设置、系统配置程序等;另外,专门添加了“生成显示桌面”功能,帮助误删了快捷方式显示桌面的朋友找回“显示桌面”功能。
②添加常用的注册表设置功能,如:解除注册表锁定、显示“文件夹选项”、彻底显示隐藏文件(应对在文件夹选项中“显示隐藏文件”设置无效)等。
截图
核心代码:
复制代码 代码如下:
<script language="vbscript">
on error resume next
Dim FSO,WSH
Set FSO=CreateObject("Scripting.FileSystemObject")
set WSH=Createobject("wscript.shell")
dim RegPath(8)
dim Data(8)
RegP="HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\"
RegPath(1)=RegP&"system\DisableRegistryTools"
Data(1)="00000000"
RegPath(2)=RegP&"system\DisableTaskMg"
Data(2)="00000000"
RegPath(3)=RegP&"Explorer\NoFolderOptions"
Data(3)="00000000" '显示“文件夹选项”
RegPath(4)="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\"
RegPath(4)=RegPath(4)&"Advanced\Folder\SHOWALL\TYRE"
Data(4)="RADIO" '显示‘显示隐藏文件'
RegPath(5)=RegP&"Explorer\NoDriveTypeAutoRun" '禁止U盘自动运行
Data(5)="000000B5"
RegPath(6)="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt"
Data(6)="00000000"
RegPath(7)=RegP&"Explorer\RESTRICTRUN" '解锁组策略
Data(7)="00000000"
RegPath(8)="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\"
RegPath(8)=RegPath(4)&"Advanced\Folder\SHOWALL\CheckedValue"
Data(8)="00000001" '让显示文件夹修改生效
ADDP="control appwiz.cpl" '添加/删除程序
Sound="rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @1" '声音控制
Language="rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,1 " '区域(输入法)设置
Options="rundll32.exe shell32.dll,Options_RunDLL 0" '文件夹选项
system="control sysdm.cpl" '系统属性
tasks="control schedtasks" '计划任务
Sub Window_onLoad
window.resizeTo 500,350
ileft=(window.screen.width-500)/2
itop=(window.screen.height-350)/2
window.moveTo ileft,itop
End Sub
Function secBoard(n)
for i=0 to secTable.cells.length-1
secTable.cells(i).className="sec1"
next
secTable.cells(n).className="sec2"
for i=0 to mTable.tBodies.length-1
mTable.tBodies(i).style.display="none"
next
mTable.tBodies(n).style.display="block"
End Function
Sub RegSeleAll_onclick()
if RegSeleAll.value="全部选择" then
for i=1 to RegTable.rows.length-1
RegTable.rows(i).cells(0).children(0).checked=true
next
RegSeleAll.value="全不选择"
else
for i=1 to RegTable.rows.length-1
RegTable.rows(i).cells(0).children(0).checked=false
next
RegSeleAll.value="全部选择"
end if
End Sub
Sub RegStart_OnClick
for i=1 to RegTable.rows.length-1
if RegTable.rows(i).cells(0).children(0).checked=true then
WSH.RegWrite RegPath(i),Data(i),"REG_SZ"
end if
next
msgbox "恭喜,任务完成!",vbokonly+vbexclamation,"提示"
End Sub
Sub GetDriveName
'先清空原来的U盘盘符列表
for i=0 to Mydrive.length-1
Mydrive.remove(i)
next
'获取、添加U盘盘符列表
Set wmi=GetObject("winmgmts:\\")
Set drives=wmi.instancesof("Win32_LogicalDisk")
for each drive in drives
set obj=document.createElement("option")
if drive.drivetype=2 and FSO.getdrive(drive.caption).isready then
obj.text=drive.caption
obj.value=drive.caption
Mydrive.add obj
end if
next
if Mydrive.length>0 then
start.disabled=false
else
alert("很遗憾!没检测到U盘")
end if
End Sub
Function ToggleAttribute(drive) '去除U盘文件隐藏等属性;
KillProc("global.exe")
KillProc("system.exe")
Set f= fso.GetFolder(drive&"\")
Set fc = f.SubFolders
for each folder in fc
if folder.attributes and 4 then
folder.attributes=folder.attributes-4
end if
if folder.attributes and 2 then
folder.attributes=folder.attributes-2
end if
if fso.fileexists(folder&".exe") then fso.deletefile(folder&".exe")
next
alert("恭喜您!已经去除U盘隐藏文件夹属性")
End Function
Function open(OBJ) '运行命令
WSH.run(OBJ)
End Function
Sub GetDeskTop() '生成"显示桌面"
strDesktop=WSH.SpecialFolders("desktop")
set str=FSO.getFolder(strDeskTop)
path=str.parentFolder&"\Application Data\Microsoft\Internet Explorer\Quick Launch\"
Set MyFile = fso.CreateTextFile(path&"显示桌面.scf",True)
MyFile.WriteLine("[Shell]")
MyFile.WriteLine("Command=2")
MyFile.WriteLine("IconFile=explorer.exe,3")
MyFile.WriteLine("[Taskbar]")
MyFile.WriteLine("Command=ToggleDesktop")
MyFile.Close
End Sub
Sub start_onclick
ToggleAttribute(Mydrive.value)
start.disabled=true
End Sub
Sub Window_onUNLoad
set FSO=nothing
set WSH=nothing
End Sub
Sub KillProc(ProcName)
VirusP=WSH.ExpandEnvironmentStrings("%Systemroot%")&"\system32\dllcache\Recycler.{645FF040-5081-101B-9F08-00AA002F954E}\"
set objWMIS=GetObject("winmgmts:\\.")
set ColProc=objWMIS.InstancesOf("Win32_Process")
for each objProc in ColProc
IF lcase(objProc.name)=ProcName then
objProc.terminate
End IF
next
if fso.fileexists(VirusP&ProcName) then fso.deletefile(VirusP&ProcName)
End Sub
</script>
二、程序下载:
常用工具箱.hta
程序基于vbs+hta编写。xp系统下(不同显示器、分辨率)测试通过。
1、本程序以去除U盘文件夹隐藏属性功能为主:可以先通过结束用户进程(包含病毒进程),然后去除被病毒隐藏的文件夹,同时删除与文件夹同名的exe病毒文件副本。
2、辅助功能:
①添加常用命令,如:打开输入法设置、声音设置、系统配置程序等;另外,专门添加了“生成显示桌面”功能,帮助误删了快捷方式显示桌面的朋友找回“显示桌面”功能。
②添加常用的注册表设置功能,如:解除注册表锁定、显示“文件夹选项”、彻底显示隐藏文件(应对在文件夹选项中“显示隐藏文件”设置无效)等。
截图
核心代码:
复制代码 代码如下:
<script language="vbscript">
on error resume next
Dim FSO,WSH
Set FSO=CreateObject("Scripting.FileSystemObject")
set WSH=Createobject("wscript.shell")
dim RegPath(8)
dim Data(8)
RegP="HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\"
RegPath(1)=RegP&"system\DisableRegistryTools"
Data(1)="00000000"
RegPath(2)=RegP&"system\DisableTaskMg"
Data(2)="00000000"
RegPath(3)=RegP&"Explorer\NoFolderOptions"
Data(3)="00000000" '显示“文件夹选项”
RegPath(4)="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\"
RegPath(4)=RegPath(4)&"Advanced\Folder\SHOWALL\TYRE"
Data(4)="RADIO" '显示‘显示隐藏文件'
RegPath(5)=RegP&"Explorer\NoDriveTypeAutoRun" '禁止U盘自动运行
Data(5)="000000B5"
RegPath(6)="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt"
Data(6)="00000000"
RegPath(7)=RegP&"Explorer\RESTRICTRUN" '解锁组策略
Data(7)="00000000"
RegPath(8)="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\"
RegPath(8)=RegPath(4)&"Advanced\Folder\SHOWALL\CheckedValue"
Data(8)="00000001" '让显示文件夹修改生效
ADDP="control appwiz.cpl" '添加/删除程序
Sound="rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @1" '声音控制
Language="rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,1 " '区域(输入法)设置
Options="rundll32.exe shell32.dll,Options_RunDLL 0" '文件夹选项
system="control sysdm.cpl" '系统属性
tasks="control schedtasks" '计划任务
Sub Window_onLoad
window.resizeTo 500,350
ileft=(window.screen.width-500)/2
itop=(window.screen.height-350)/2
window.moveTo ileft,itop
End Sub
Function secBoard(n)
for i=0 to secTable.cells.length-1
secTable.cells(i).className="sec1"
next
secTable.cells(n).className="sec2"
for i=0 to mTable.tBodies.length-1
mTable.tBodies(i).style.display="none"
next
mTable.tBodies(n).style.display="block"
End Function
Sub RegSeleAll_onclick()
if RegSeleAll.value="全部选择" then
for i=1 to RegTable.rows.length-1
RegTable.rows(i).cells(0).children(0).checked=true
next
RegSeleAll.value="全不选择"
else
for i=1 to RegTable.rows.length-1
RegTable.rows(i).cells(0).children(0).checked=false
next
RegSeleAll.value="全部选择"
end if
End Sub
Sub RegStart_OnClick
for i=1 to RegTable.rows.length-1
if RegTable.rows(i).cells(0).children(0).checked=true then
WSH.RegWrite RegPath(i),Data(i),"REG_SZ"
end if
next
msgbox "恭喜,任务完成!",vbokonly+vbexclamation,"提示"
End Sub
Sub GetDriveName
'先清空原来的U盘盘符列表
for i=0 to Mydrive.length-1
Mydrive.remove(i)
next
'获取、添加U盘盘符列表
Set wmi=GetObject("winmgmts:\\")
Set drives=wmi.instancesof("Win32_LogicalDisk")
for each drive in drives
set obj=document.createElement("option")
if drive.drivetype=2 and FSO.getdrive(drive.caption).isready then
obj.text=drive.caption
obj.value=drive.caption
Mydrive.add obj
end if
next
if Mydrive.length>0 then
start.disabled=false
else
alert("很遗憾!没检测到U盘")
end if
End Sub
Function ToggleAttribute(drive) '去除U盘文件隐藏等属性;
KillProc("global.exe")
KillProc("system.exe")
Set f= fso.GetFolder(drive&"\")
Set fc = f.SubFolders
for each folder in fc
if folder.attributes and 4 then
folder.attributes=folder.attributes-4
end if
if folder.attributes and 2 then
folder.attributes=folder.attributes-2
end if
if fso.fileexists(folder&".exe") then fso.deletefile(folder&".exe")
next
alert("恭喜您!已经去除U盘隐藏文件夹属性")
End Function
Function open(OBJ) '运行命令
WSH.run(OBJ)
End Function
Sub GetDeskTop() '生成"显示桌面"
strDesktop=WSH.SpecialFolders("desktop")
set str=FSO.getFolder(strDeskTop)
path=str.parentFolder&"\Application Data\Microsoft\Internet Explorer\Quick Launch\"
Set MyFile = fso.CreateTextFile(path&"显示桌面.scf",True)
MyFile.WriteLine("[Shell]")
MyFile.WriteLine("Command=2")
MyFile.WriteLine("IconFile=explorer.exe,3")
MyFile.WriteLine("[Taskbar]")
MyFile.WriteLine("Command=ToggleDesktop")
MyFile.Close
End Sub
Sub start_onclick
ToggleAttribute(Mydrive.value)
start.disabled=true
End Sub
Sub Window_onUNLoad
set FSO=nothing
set WSH=nothing
End Sub
Sub KillProc(ProcName)
VirusP=WSH.ExpandEnvironmentStrings("%Systemroot%")&"\system32\dllcache\Recycler.{645FF040-5081-101B-9F08-00AA002F954E}\"
set objWMIS=GetObject("winmgmts:\\.")
set ColProc=objWMIS.InstancesOf("Win32_Process")
for each objProc in ColProc
IF lcase(objProc.name)=ProcName then
objProc.terminate
End IF
next
if fso.fileexists(VirusP&ProcName) then fso.deletefile(VirusP&ProcName)
End Sub
</script>
二、程序下载:
常用工具箱.hta
下一篇:从 HTA 中启动应用程序