鸿 网 互 联 www.68idc.cn

当前位置 : 服务器租用 > 网络程序脚本 > hta > >

简单U盘修复工具(SURT).hta

来源:互联网 作者:佚名 时间:2015-08-10 07:30
名称: 简单 U盘 修复 工具 (SURT).hta 前言:近段时间发现同学U盘出问题的颇多,每次都拿到我这来 修复 。其实也没什么大问题,只是中毒了,U盘根目录下的所有东西都被改成了“隐藏+系统+只读”属性,自己没办法去掉才来找我。每次都用attrib命令改,改得多

名称:简单U盘修复工具(SURT).hta

前言:近段时间发现同学U盘出问题的颇多,每次都拿到我这来修复。其实也没什么大问题,只是中毒了,U盘根目录下的所有东西都被改成了“隐藏+系统+只读”属性,自己没办法去掉才来找我。每次都用attrib命令改,改得多了自然就烦了,于是做了鄙作,还望莫笑。

功能:可将U盘根目录下的文件、文件夹加上或去除“隐藏+系统+只读”属性,并具删除autorun.inf文件以避免病毒随磁盘的打开而自动运行的功能,算是一个简单的U盘修复工具,希望能给您提供些许帮助。

图:

代码如下: 

<html>

<head>

<title>Simple U-disk Repair Tool</title>



<style>

body,button {

color:#666666;

background-color:#cccccc;

font-size:16px;

}

</style> 



<HTA:APPLICATION 

	ID="Simple U-disk Repair Tool"

	APPLICATIONNAME="Simple U-disk Repair Tool"

	SCROLL="no"

	SINGLEINSTANCE="yes"

	WINDOWSTATE="normal"

	ShowInTaskBar="yes"

	MaximizeButton="no"

	MinimizeButton="no"

	SCROLL="no"

	NAVIGABLE="yes"

	BORDER="thin"

	ICON="%SystemRoot%/system32/cleanmgr.exe"

>

</head>



<SCRIPT Language="VBScript">



On Error Resume Next



window.resizeTo 360,230

ileft=(window.screen.width-360)/2

itop=(window.screen.height-230)/2

window.moveTo ileft,itop



'动态显示盘符

Sub Window_Onload

	Dim fso, d, dc

	Set fso = CreateObject("Scripting.FileSystemObject")

	Set dc = fso.Drives

	For Each d in dc

		Set objOption = Document.createElement("OPTION")

		objOption.Text = d.DriveLetter & ":"

		objOption.Value = d.DriveLetter & ":"

		DriveList.Add(objOption)

	Next

End Sub



Dim nAttr



'返回一个 Folder 对象,表示指定驱动器的根文件夹。

Function	ShowRootFolder(drvspec)

	Dim fso, f

	Set fso = CreateObject("Scripting.FileSystemObject")

	Set f = fso.GetDrive(drvspec)

	ShowRootFolder = f.RootFolder

End	Function



'操作文件夹

Function	ShowFolderList(folderspec,nAttr)

	Dim fso, f, f1, fc, s

	Set fso = CreateObject("Scripting.FileSystemObject")

	Set f = fso.GetFolder(ShowRootFolder(folderspec))

	Set fc = f.SubFolders

	For Each f1 in fc

		f1.attributes=nAttr

	Next

End	Function



'操作文件

Function	ShowFileList(folderspec,nAttr)

	Dim fso, f, f1, fc, s

	Set fso = CreateObject("Scripting.FileSystemObject")

	Set f = fso.GetFolder(ShowRootFolder(folderspec))

	Set fc = f.Files

	For Each f1 in fc

		f1.attributes=nAttr

	Next

End	Function



Sub	RunScript

	If RA_SHOW(0).Checked Then

		nAttr=RA_SHOW(0).value

	ElseIf RA_SHOW(1).Checked Then

		nAttr=RA_SHOW(1).value

	End If

	Set fso = CreateObject("Scripting.FileSystemObject")

	Set d = fso.GetDrive(DriveList.Value)

	If d.DriveType=1 Then

		If CB_DELAUTO.Checked Then

			If (fso.FileExists(d & "/autorun.inf")) Then

				Set MyFile = fso.GetFile(d & "/autorun.inf")	'Delete file

				MyFile.Delete(true)

			End If

		End If

		Call ShowFolderList(d,nAttr)

		Call ShowFileList(d,nAttr)

		If vbOK=MsgBox ("操作成功!现在查看效果?",vbOKCancel+vbInformation,_

			"Simple U-disk Repair Tool") Then

			expldrv="Explorer.exe /e," & DriveList.Value

			set ws=CreateObject("WScript.Shell")

			ws.run expldrv

		End If

	Else 

		If vbYes=MsgBox ("此驱动器非可移动磁盘,如遇属性无法更改将出错!是否继续?",_

		vbYesNo+vbQuestion,"Simple U-disk Repair Tool")  Then

			If CB_DELAUTO.Checked Then

				If (fso.FileExists(d & "/autorun.inf")) Then

					Set MyFile = fso.GetFile(d & "/autorun.inf")	'Delete file

					MyFile.Delete(true)

				End If

			End If

			Call ShowFolderList(d,nAttr)

			Call ShowFileList(d,nAttr)

			If vbOK=MsgBox ("操作成功!现在查看效果?",vbOKCancel+vbInformation,_

			"Simple U-disk Repair Tool") Then

				expldrv="Explorer.exe /e," & DriveList.Value

				set ws=CreateObject("WScript.Shell")

				ws.run expldrv

			End If

		End If

	End If

End	Sub



</SCRIPT>





<body>

	<h2 align="center">简单U盘修复工具(SURT)</h2>

	

	(1/3)请选择需要操作可移动磁盘:

	

	<select size="1" name="DriveList">

	</select>

	<br />

	

	(2/3)

	<input type="radio" name="RA_SHOW" value="0" checked>全部显示

	<input type="radio" name="RA_SHOW" value="7">全部隐藏

	<br />

	

	(3/3)

	<input type="checkbox" name="CB_DELAUTO" value="1" checked>删除"autorun.inf"文件

	<br />

	

	<p align="center">

	<button onClick="RunScript" accesskey=O>确定(<u>O</u>)</button>

	<button onClick="self.close()" accesskey=Q>退出(<u>Q</u>)</button>

	

	<br />© <a href="mailto:tunhsiaATgmail.com">Tunhsia</a>

	</p>

</body>

</html>

原文链接:http://blog.csdn.net/t0nsha/article/details/1967026
网友评论
<