Board logo

标题: 做了个免疫老有这个提示,能去掉吗? [打印本页]

作者: lzymbz     时间: 2008-9-11 02:31    标题: 做了个免疫老有这个提示,能去掉吗?

@echo off
for %%a 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 @(
    if exist %%a:\nul (
        rd %%a:\autorun.inf /s /q >nul 2>nul
        del %%a:\autorun.inf /f /q >nul 2>nul
        mkdir %%a:\autorun.inf >nul 2>nul
        mkdir %%a:\autorun.inf\"病毒免疫勿删除../"  >nul 2>nul
        copy autorun.ico %%a:\autorun.inf\autorun.ico >nul 2>nul
        copy desktop.ini %%a:\autorun.inf\desktop.ini >nul 2>nul
        attrib +h +r +s %%a:\autorun.inf\desktop.ini >nul 2>nul
        attrib +h +r +s %%a:\autorun.inf >nul 2>nul
        
    )
)

echo.
exit


注:h盘是光驱

[ Last edited by lzymbz on 2008-9-11 at 07:50 AM ]
附件 1: Snap1.gif (2008-9-11 02:31, 4.97 K)



作者: zch123     时间: 2008-9-11 14:04
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)

把你这里面的H删除,就可以了。
你光驱它不能写入文件,当然出错了。
作者: lzymbz     时间: 2008-9-11 17:26
大哥,我知道我的电脑h是光驱

那别人的呢?

我要做个通用的啊
作者: hackate     时间: 2008-9-11 21:22
@echo off
for /f "skip=1" %%i in ('wmic cdrom get id') do (
set str=%%i
set str=%str:~0,1%
echo %str%
)
pause

这段代码是获取CD-ROM光驱的盘符的,你可以先用此代码获取光区的盘符,
然后在你的代码循环里面判断一下,if not "%%a"=="%str%"
然后执行你的代码嘛.呵呵。这样就不会出提示啦
作者: HAT     时间: 2008-9-11 21:27    标题: Re 4楼

如果有两个或者两个以上的光驱(物理光驱+虚拟光驱)呢?
作者: metoo     时间: 2008-9-11 22:00
偶用一个效率不高的笨办法
dir !drive! >nul 2>nul&&if exist !drive!\autorun.inf\nul (...
如果软驱直接在dir上就过不去还不会跳这个错误