本文主要是介绍antiautorun v1.0.vbs,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
' filename:"antiautorun v1.0.vbs"
' function:自动删除"autorun.inf"文件,并打上免疫补丁
' writer:t0nsha @070812 WinXPSP2测试通过!
' Email:liaodunxia{at}gmail.com
msg = MsgBox ( " 本脚本将删除各分区根目录下的autorun.inf文件,而后建立autorun.inf文件夹以帮助您对抗autorun病毒(针对硬盘和U盘,建议每插上U盘后运行一次)。此为免费软件,本人不对因其造成的损失负责!继续? " , 4 + 32 + 256 , " antiautorun v1.0 免责声明 " )
if msg = vbNo then
WScript.Quit ( 1 )
end if
filespec = " autorun.inf "
Set fso = CreateObject ( " Scripting.FileSystemObject " )
Set dc = fso.Drives
For Each d in dc
Set fso = CreateObject ( " Scripting.FileSystemObject " )
Set d = fso.GetDrive(fso.GetDriveName(d))
if d.DriveType = 2 or d.DriveType = 1 then ' 只对本地磁盘与U盘检查
' 判断是有"autorun.inf"文件,有则删除
If (fso.FileExists(d & " " & filespec)) Then ' 与隐藏扩展名无关
' msgbox(d & "" & filespec & "exists")
Set MyFile = fso.GetFile(d & " " & filespec) ' Delete file
MyFile.Delete( true ) ' true代表可以删除有只读属性的文件
end if
' 建立"autorun.inf"文件夹
If (fso.FolderExists(d & " " & filespec)) Then
Set MyFolder = fso.GetFolder(d & " " & filespec)
MyFolder.delete( true )
end if
Set f = fso.CreateFolder(d & " " & filespec)
f.Attributes = 7 ' 设置文件夹属性,7代表系统文件
end if
Next
msg2 = MsgBox ( " 免疫完成!欢迎访问我的Blog:blog.csdn.net/t0nsha " , 0 + 64 , " 恭喜 " )
' function:自动删除"autorun.inf"文件,并打上免疫补丁
' writer:t0nsha @070812 WinXPSP2测试通过!
' Email:liaodunxia{at}gmail.com
msg = MsgBox ( " 本脚本将删除各分区根目录下的autorun.inf文件,而后建立autorun.inf文件夹以帮助您对抗autorun病毒(针对硬盘和U盘,建议每插上U盘后运行一次)。此为免费软件,本人不对因其造成的损失负责!继续? " , 4 + 32 + 256 , " antiautorun v1.0 免责声明 " )
if msg = vbNo then
WScript.Quit ( 1 )
end if
filespec = " autorun.inf "
Set fso = CreateObject ( " Scripting.FileSystemObject " )
Set dc = fso.Drives
For Each d in dc
Set fso = CreateObject ( " Scripting.FileSystemObject " )
Set d = fso.GetDrive(fso.GetDriveName(d))
if d.DriveType = 2 or d.DriveType = 1 then ' 只对本地磁盘与U盘检查
' 判断是有"autorun.inf"文件,有则删除
If (fso.FileExists(d & " " & filespec)) Then ' 与隐藏扩展名无关
' msgbox(d & "" & filespec & "exists")
Set MyFile = fso.GetFile(d & " " & filespec) ' Delete file
MyFile.Delete( true ) ' true代表可以删除有只读属性的文件
end if
' 建立"autorun.inf"文件夹
If (fso.FolderExists(d & " " & filespec)) Then
Set MyFolder = fso.GetFolder(d & " " & filespec)
MyFolder.delete( true )
end if
Set f = fso.CreateFolder(d & " " & filespec)
f.Attributes = 7 ' 设置文件夹属性,7代表系统文件
end if
Next
msg2 = MsgBox ( " 免疫完成!欢迎访问我的Blog:blog.csdn.net/t0nsha " , 0 + 64 , " 恭喜 " )
所有d & "" & filespec
应改为:
d & "/" & filespec
这篇关于antiautorun v1.0.vbs的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!