for语句在bat批处理中怎么写

@echo off
C:
cd\
attrib -s -h -r autorun.inf /s /d
del autorun.inf /f/s/q/a
cls
D:
cd\
attrib -s -h -r autorun.inf /s /d
del autorun.inf /f/s/q/a
cls
E:
cd\
attrib -s -h -r autorun.inf /s /d
del autorun.inf /f/s/q/a
cls
F:
cd\
attrib -s -h -r autorun.inf /s /d
del autorun.inf /f/s/q/a
cls
.
.
.
.
用 FOR /D %variable IN (set) DO command [command-parameters]
语句怎么表达请大侠们指点
@echo off
FOR %%I IN (C: D: E: F:) DO (%%I: cd\ attrib -s -h -r autorun.inf /s /d del autorun.inf /f/s/q/a cls>nul )
还是
@echo off
FOR %%I IN (C: D: E: F:) DO (%%I: >nul cd\ attrib -s -h -r autorun.inf /s /d >nul del autorun.inf /f/s/q/a >nul cls >nul )
都是错误的请大侠们指点(尤其是回车键在for语句中怎么表达啊)

以下这个批处理就可以解决你的问题。
@echo off
for %%a in (
c d e f
) do (
attrib -s -h -r %%a:\autorun.inf /s /d
del %%a:\autorun.inf /f /s /q /a
)
pause
温馨提示:答案为网友推荐,仅供参考
相似回答