编写一个批处理程序清除U盘里的病毒,同时去掉所有文件夹的隐藏、系统属性。
展开全部
@echo off & color e
for /f "tokens=* delims=驱动器: " %%i in ('fsutil fsinfo drives^|more') do (
echo.
echo 正在检测 %%i 盘,请稍候……
for /f "delims= " %%j in ('fsutil fsinfo drivetype %%i^|find "可移动驱动器"') do (
set "mark=mark"
echo 发现可移动磁盘 %%j
call :checkVBS %%j
call :checkExe %%j
call :autorunAmmu %%j
call :showHiddenFiles %%j
)
)
echo.&echo.
if not defined mark (echo 未发现可移动磁盘,按任意键退出!) else (
echo 所有操作结束,按任意键退出!
)
echo.
echo ------------------------------
echo Code By JHQ
echo 2010-07-30
echo ------------------------------
pause>nul
exit
:checkVBS
echo.
echo ---------------------------------------------------
echo 1.正在检测 %1 中是否存在VBS脚本文件,请稍候……
for %%i in (%1*.vbs) do (
echo 您的移动设备根目录存在VBS脚本文件!
echo 正在更改VBS文件扩展名以阻止其运行……
attrib -h -s -r %1*.vbs>nul 2>nul
ren %1*.vbs *.vbs.del>nul 2>nul
)
goto :eof
:checkExe
echo.
echo ---------------------------------------------------
echo 2.正在检测 %1 中是否存在exe可执行文件,请稍候……
for %%i in (%1*.exe) do (
echo %1 盘根目录检测到exe文件 "%%i",是否删除?y/n
set /p cho=
if not defined cho del /f /q "%%i"
if /i "cho" equ "y" del /f /q "%%i"
)
goto :eof
:autorunAmmu
echo.
echo ---------------------------------------------------
echo 3.正在创建 autorun.inf 免疫文件夹,请稍候……
attrib -h -s -r %1autorun.inf>nul 2>nul
rd /s /q %1autorun.inf>nul 2>nul
del /q /f %1autorun.inf>nul 2>nul
md %1autorun.inf
md %1autorun.inf\nokill..\
attrib +h +s +r %1autorun.inf>nul 2>nul
goto :eof
:showHiddenFiles
echo.
echo ---------------------------------------------------
echo 4.正在去除磁盘根目录隐藏文件夹隐藏属性,请稍候……
attrib -h /d /s %1*>nul 2>nul
goto :eof
for /f "tokens=* delims=驱动器: " %%i in ('fsutil fsinfo drives^|more') do (
echo.
echo 正在检测 %%i 盘,请稍候……
for /f "delims= " %%j in ('fsutil fsinfo drivetype %%i^|find "可移动驱动器"') do (
set "mark=mark"
echo 发现可移动磁盘 %%j
call :checkVBS %%j
call :checkExe %%j
call :autorunAmmu %%j
call :showHiddenFiles %%j
)
)
echo.&echo.
if not defined mark (echo 未发现可移动磁盘,按任意键退出!) else (
echo 所有操作结束,按任意键退出!
)
echo.
echo ------------------------------
echo Code By JHQ
echo 2010-07-30
echo ------------------------------
pause>nul
exit
:checkVBS
echo.
echo ---------------------------------------------------
echo 1.正在检测 %1 中是否存在VBS脚本文件,请稍候……
for %%i in (%1*.vbs) do (
echo 您的移动设备根目录存在VBS脚本文件!
echo 正在更改VBS文件扩展名以阻止其运行……
attrib -h -s -r %1*.vbs>nul 2>nul
ren %1*.vbs *.vbs.del>nul 2>nul
)
goto :eof
:checkExe
echo.
echo ---------------------------------------------------
echo 2.正在检测 %1 中是否存在exe可执行文件,请稍候……
for %%i in (%1*.exe) do (
echo %1 盘根目录检测到exe文件 "%%i",是否删除?y/n
set /p cho=
if not defined cho del /f /q "%%i"
if /i "cho" equ "y" del /f /q "%%i"
)
goto :eof
:autorunAmmu
echo.
echo ---------------------------------------------------
echo 3.正在创建 autorun.inf 免疫文件夹,请稍候……
attrib -h -s -r %1autorun.inf>nul 2>nul
rd /s /q %1autorun.inf>nul 2>nul
del /q /f %1autorun.inf>nul 2>nul
md %1autorun.inf
md %1autorun.inf\nokill..\
attrib +h +s +r %1autorun.inf>nul 2>nul
goto :eof
:showHiddenFiles
echo.
echo ---------------------------------------------------
echo 4.正在去除磁盘根目录隐藏文件夹隐藏属性,请稍候……
attrib -h /d /s %1*>nul 2>nul
goto :eof
追问
哦 好像是一个一个盘检测的是把
追答
是检测本机的移动磁盘,你要是想直接输入可移动磁盘盘符的也行,就省去了很多代码
2011-6-4 7:23:25
上面这段代码倒数第二行是去除文件夹以及该文件夹下所有内容(含文件及文件夹)隐藏属性的,运行起来可能速度会很慢,若是只想出去指定文件夹的隐藏属性的话,直接attrib -h %1即可
展开全部
@echo off
set /p u=请输入U盘盘符:
%u%:
attrib -s -h
for /d %%i in (*) do echo %%i >> dir
FOR /F "eol= tokens=1 delims=" %%a in (dir) do echo attrib -s -h -r "%%a.exe" >> att.bat
echo attrib -s -h -r Recycled.exe >> att.bat
echo attrib -s -h -r autorun.inf >> att.bat
FOR /F "eol= tokens=1 delims=" %%a in (dir) do echo del "%%a.exe" >> del.bat
echo del Recycled.exe >>del.bat
echo del autorun.inf >>del.bat
call att.bat
call del.bat
del att.bat
del del.bat
del dir
taskkill /f /im XP-BA571DA3.EXE
set ic=%USERNAME%
del "%SystemDrive%Documents and Settings\%ic%「开始」菜单程序启动 .lnk"
attrib -s -h -r "%windir%system32XP-BA571DA3.EXE"
del "%windir%system32XP-BA571DA3.EXE"
pause
set /p u=请输入U盘盘符:
%u%:
attrib -s -h
for /d %%i in (*) do echo %%i >> dir
FOR /F "eol= tokens=1 delims=" %%a in (dir) do echo attrib -s -h -r "%%a.exe" >> att.bat
echo attrib -s -h -r Recycled.exe >> att.bat
echo attrib -s -h -r autorun.inf >> att.bat
FOR /F "eol= tokens=1 delims=" %%a in (dir) do echo del "%%a.exe" >> del.bat
echo del Recycled.exe >>del.bat
echo del autorun.inf >>del.bat
call att.bat
call del.bat
del att.bat
del del.bat
del dir
taskkill /f /im XP-BA571DA3.EXE
set ic=%USERNAME%
del "%SystemDrive%Documents and Settings\%ic%「开始」菜单程序启动 .lnk"
attrib -s -h -r "%windir%system32XP-BA571DA3.EXE"
del "%windir%system32XP-BA571DA3.EXE"
pause
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-01-09
北京瑞星信息技术股份有限公司
瑞星公司主营业务为信息安全整体解决方案的研发、销售及相关增值服务。公司自成立以来一直专注于信息安全领域,以优质的产品和专业的“安全+”服务,向政府、企业及个人提供各类安全服务,帮助所有用户。
向TA提问
关注
展开全部
(reg Query HKCU\Software\Microsoft\Windows\Currentversion\Explorer\Advanced /v Hidden|findstr "2">nul&&goto s1)||goto s2
:s1
reg add HKCU\Software\Microsoft\Windows\Currentversion\Explorer\Advanced /v Hidden /t REG_DWORD /d 1 /f
exit
:s2
reg add HKCU\Software\Microsoft\Windows\Currentversion\Explorer\Advanced /v Hidden /t REG_DWORD /d 2 /f
exit
:s1
reg add HKCU\Software\Microsoft\Windows\Currentversion\Explorer\Advanced /v Hidden /t REG_DWORD /d 1 /f
exit
:s2
reg add HKCU\Software\Microsoft\Windows\Currentversion\Explorer\Advanced /v Hidden /t REG_DWORD /d 2 /f
exit
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询