从可移动驱动器中删除文件的批处理文件命令(病毒)

时间:2016-12-07 01:15:48

标签: batch-file cmd

我不知道如何自己编码,只是设法从谷歌找到一些并尝试编译它。但它并没有像我预期的那样奏效。最近我发现在我的地方有病毒传播而没有用户意识到它。批处理文件应该从指定驱动器的%temp%文件夹中删除文件,扩展名为.exe,正好为138784字节。这是我提出的批处理文件,它可以从临时文件夹中删除它,但不能删除可移动驱动器上的文件:

@ECHO OFF
ECHO "Enter Drive letter"
set /p letter=
for /r %%f in (*.exe) do if %%~zF EQU 138784 del %%F /f
attrib -s -h -a /s /d %letter%:*.*
c:
cd %temp%
Del wdr201.exe /f
ECHO "Process completed."
Pause

1 个答案:

答案 0 :(得分:0)

您可以试试这个受此启发的代码: Hackoo_Virus_Cleaner.bat

@echo off
Mode con cols=80 lines=6 & Color 9E
Title Searching the Drive letter of your USB Key and clean *.lnk files by Hackoo 2016
Set TmpLogFile=%tmp%\TmpLog.txt
Set "LogFile=%UserProfile%\Desktop\Hackoo_Virus_Clean_%UserName%_Log.txt"
If Exist %TmpLogFile% Del %TmpLogFile%
If Exist %LogFile% Del %LogFile%
for /f "tokens=2" %%i in ('wmic logicaldisk where "drivetype=2" ^|find /i ":"') do (Set MyUSB=%%i)
cls
setlocal ENABLEDELAYEDEXPANSION
set _drive=%MyUSB%
If Exist !_drive! (
cls
echo.
echo           #########################################################
echo                        Your usb key is connected as !_drive!
echo           #########################################################
echo           Hit any key to remove malicious files and unhide files ...
pause>nul
Cls
echo(
Echo Removing malicious files/unhiding files... Please wait, this may take a while...
del /s /f /q !_drive!\*.lnk>>"%TmpLogFile%"2>&1
Cmd /U /C Type "%TmpLogFile%" > "%LogFile%"
Start "" %LogFile%
attrib -s -h -a -r /s /d !_drive!\*.*
Explorer "!_drive!\"
) ELSE (
cls
color 0C
echo.
echo           #########################################################
echo                         Your usb key is not detected
echo           #########################################################
echo.
)
pause & exit