Показаны различия между двумя версиями страницы.
— |
usb_cleaner_vbs [2018/02/17 16:08] (текущий) sector создано |
||
---|---|---|---|
Строка 1: | Строка 1: | ||
+ | USB cleaner VBS | ||
+ | <code ini| title> | ||
+ | Wscript.Echo "USB cleaner Запущен" | ||
+ | Set objWMIService = GetObject(" | ||
+ | Set objEvents = objWMIService.ExecNotificationQuery (" | ||
+ | Set objFS = CreateObject(" | ||
+ | Do | ||
+ | Set objReceivedEvent = objEvents.NextEvent | ||
+ | strPath = objFS.BuildPath(objReceivedEvent.TargetInstance.Caption, | ||
+ | If objFS.FolderExists(strPath) Then | ||
+ | On Error Resume Next | ||
+ | Set objFolder = objFS.GetFolder(strPath) | ||
+ | If Err.Number = 0 Then | ||
+ | For Each objItem In objFolder.SubFolders | ||
+ | If objItem.Attributes And 2 Then objItem.Attributes = objItem.Attributes - 2 | ||
+ | If Err.Number <> 0 Then Err.Clear | ||
+ | Next | ||
+ | For Each objItem In objFolder.Files | ||
+ | If objItem.Attributes And 2 Then objItem.Attributes = objItem.Attributes - 2 | ||
+ | If Err.Number <> 0 Then Err.Clear | ||
+ | Next | ||
+ | For Each File in objFolder.Files | ||
+ | If LCase(objFS.GetExtensionName(File)) = " | ||
+ | File.Delete true | ||
+ | End If | ||
+ | Next | ||
+ | For Each File in objFolder.Files | ||
+ | If LCase(objFS.GetExtensionName(File)) = " | ||
+ | File.Delete true | ||
+ | End If | ||
+ | Next | ||
+ | For Each File in objFolder.Files | ||
+ | If LCase(objFS.GetExtensionName(File)) = " | ||
+ | File.Delete true | ||
+ | End If | ||
+ | Next | ||
+ | For Each File in objFolder.Files | ||
+ | If LCase(objFS.GetFileName(File)) = " | ||
+ | File.Delete true | ||
+ | End If | ||
+ | Next | ||
+ | Else | ||
+ | Err.Clear | ||
+ | End If | ||
+ | Set objItem = Nothing: Set objFolder = Nothing | ||
+ | End If | ||
+ | Wscript.Echo "USB флешка успешно очищена" | ||
+ | Loop | ||
+ | </ |