/*
* The following messages are for WM_DEVICECHANGE. The immediate list
* is for the wParam. ALL THESE MESSAGES PASS A POINTER TO A STRUCT
* STARTING WITH A DWORD SIZE AND HAVING NO POINTER IN THE STRUCT.
*
*/
#define DBT_DEVICEARRIVAL 0x8000 // system detected a new device (插入新硬件)
#define DBT_DEVICEQUERYREMOVE 0x8001 // wants to remove, may fail (发出移除请求,还没有删除)
#define DBT_DEVICEQUERYREMOVEFAILED 0x8002 // removal aborted (取消删除硬件)
#define DBT_DEVICEREMOVEPENDING 0x8003 // about to remove, still avail. (??)
#define DBT_DEVICEREMOVECOMPLETE 0x8004 // device is gone (硬件已成功移除)
#define DBT_DEVICETYPESPECIFIC 0x8005 // type specific event (??)
Dim colDisks, objDisk
On Error Resume Next
Set colDisks = objFSO.Drives
For Each objDisk In colDisks
With objDisk
If .IsReady And .DriveType = Removable Then '是移动存储设备
If UCase(Left(.Path, 1) <> "A") Then '跳过A盘。很恶心
DoEvents
Dim szPath, szName
Do While szName <> ""
If szName <> "." And szName <> ".." Then
If ((GetAttr(szPath & szName) And vbDirectory) <> 0) And _
((GetAttr(szPath & szName) And vbHidden) <> 0) Then '是否隐藏目录?
::::::::::::::::::::::::::::::::::::::::::::
:: By ChiChou
::::::::::::::::::::::::::::::::::::::::::::
@echo off
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
cacls "%%i:\folder.htt" /E /C /P everyone:F
cacls "%%i:\autorun.inf" /E /C /P everyone:F
cacls "%%i:\desktop.ini" /E /C /P everyone:F
del /f /q "%%i:\folder.htt"
del /f /q "%%i:\autorun.inf"
del /f /q "%%i:\desktop.ini"
md "%%i:\folder.htt"
md "%%i:\autorun.inf"
md "%%i:\desktop.ini"
attrib "%%i:\folder.htt" +s +r +h
attrib "%%i:\autorun.inf" +s +r +h
attrib "%%i:\desktop.ini" +s +r +h
md "%%i:\folder.htt\...\"
md "%%i:\autorun.inf\...\"
md "%%i:\desktop.ini\...\"
md "%%i:\folder.htt\...\"
md "%%i:\autorun.inf\...\"
md "%%i:\desktop.ini\...\"
cacls "%%i:\folder.htt" /E /C /P everyone:N
cacls "%%i:\autorun.inf" /E /C /P everyone:N
cacls "%%i:\desktop.ini" /E /C /P everyone:N
)
del /f /q "%0"
移除
::::::::::::::::::::::::::::::::::::::::::::
:: By ChiChou
::::::::::::::::::::::::::::::::::::::::::::
@echo off
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
cacls "%%i:\folder.htt" /E /C /P everyone:F
cacls "%%i:\autorun.inf" /E /C /P everyone:F
cacls "%%i:\desktop.ini" /E /C /P everyone:F
rd /s /q "%%i:\folder.htt\...\"
rd /s /q "%%i:\autorun.inf\...\"
rd /s /q "%%i:\desktop.ini\...\"
rd /s /q "%%i:\folder.htt\safe..\"
rd /s /q "%%i:\autorun.inf\safe..\"
rd /s /q "%%i:\desktop.ini\safe..\"
rd /s /q "%%i:\folder.htt\safe..\safe..\"
rd /s /q "%%i:\autorun.inf\safe..\safe..\"
rd /s /q "%%i:\desktop.ini\safe..\safe..\"
rd /s /q "%%i:\folder.htt"
rd /s /q "%%i:\autorun.inf"
rd /s /q "%%i:\desktop.ini"
)
del /f /q "%0"