精通批处理的来

来源:百度知道 编辑:UC知道 时间:2024/05/12 16:33:54
我想学写批处理,遇到点问题/高手帮忙
@echo off
title autorun免疫
color 1e
:1
echo 是否进行免疫(是按1 去除免疫按2 退出按3)
echo -----------------------------------
echo -----------------------------------
set /p a=请输入对应的按回车:
if /i "%a%"=="1" goto 2
if /i "%a%"=="2" goto 3
if /i "%a%"=="3" goto 4
echo
:2
md c:\autorun.inf\
attrib +s +h +r c:\autorun.inf\
md d:\autorun.inf\
attrib +s +h +r d:\autorun.inf\
md e:\autorun.inf\
attrib +s +h +r e:\autorun.inf\
md f:\autorun.inf\
attrib +s +h +r f:\autorun.inf\
md g:\autorun.inf\
attrib +s +h +r g:\autorun.inf\
md h:\autorun.inf\
attrib +s +h +r h:\autorun.inf\
md i:\autorun.inf\
attrib +s +h +r i:\autorun.inf\
md j:\autorun.inf\
attrib +s +h +r j:\

一 你2 和3 的冒号打错了打成中文的输入法了 要用英文的,其余冒号有没有错自己找吧
二 你4都没贴出来不知道后面都是啥内容
三 每个选择结束的时候应该有个exit,exit之前你可以输出点表示成功的信息

:2,:3的最后面要加入 exit 退出,不然会继续执行的。
最好在
if /i "%a%"=="1" goto 2
if /i "%a%"=="2" goto 3
if /i "%a%"=="3" goto 4
后加入
goto 1
这样输错了可重来。