sth about "批处理文件"

最近想学点windows下批处理文件(.bat)知识,

批处理文件是由一个或一个以上的DOS命令及可执行命令组成的带有扩展名.BAT的文件。当用户以批处理文件名为命令时,DOS会自动依次执行文件中的命令。批处理文件的特点是一次建立可多次执行。

在批处理文件中有一个特殊的批处理文件,每次启动计算机时,系统自动执行该文件中的每一条命令。该文件必须满足两个条件:一是文件名为AUTOEXEC.BAT,二是该文件的位置必须放在启动盘(也可称为系统盘)的根目录下。:-) 注:这是在以前的98, 2000系统中的说明,在xp中要使用开机自动运行批处理文件必须在run"gpedit.msc">>计算机配置>>windows设置>>Scripts(startup/shutdown) 里add一个批处理文件,当然文件名可以取autoexec.bat。不过完全可以通过新建一个批处理文件a.bat, 再在启动文件夹(startup,在开始菜单里)里添加a.bat的快捷方式。呵呵,跑题了

在批处理文件中除了使用DOS命令之外,还可使用批处理子命令,这些命令也可看作DOS的内部命令。 echo、@、call、pause、rem 是批处理文件最常用的几个命令,我们就从他们开始学起。 echo 表示显示此命令后的字符
echo off 表示在此语句后所有运行的命令都不显示命令行本身
@ 与echo off相象,但它是加在其它命令行的最前面,表示运行时不显示命令行本身。
call 调用另一条批处理文件(如果直接调用别的批处理文件 ,执行完那条文件后将无法执行当前文件后续命令)
pause 运行此句会暂停,显示Press any key to continue... 等待用户按任意键后继续
rem 表示此命令后的字符为解释行,不执行,只是给自己今后查找用的

批处理文件中还可以像C语言一样使用参数,这只需用到一个参数表示符%。
   %表示参数,参数是指在运行批处理文件时在文件名后加的字符串,例如在cmd里输入语句 "a.bat para1 para2 para3"。变量可以从 %0到%9,%0表示文件名本身,字符串用%1到%9顺序表示;即在a.bat 文件内部就可以用 %0指代a.bat, %1指代第一个参数para1, ...

if goto choice for 是批处理文件中比较高级的命令,如果这几个你用得很熟练,你就是批处理文件的专家啦。
这里只介绍后两个:

choice 使用此命令可以让用户输入一个字符,从而运行不同的命令。使用时应该加/c:参数,c:后应写提示可输入的字符,之间无空格。它的返回码为1234……

如: choice /c:dme defrag,mem,end
将显示
defrag,mem,end[D,M,E]?

例如,test.bat的内容如下:

@echo   off  
choice   / c :dme  defrag , mem , end  
if   errorlevel   3   goto  defrag 应先判断数值最高的错误码
if   errorlevel   2   goto   mem  
if  errotlevel  1   goto   end  

:defrag  
c:
dos defrag 
goto   end  

:mem  
mem  
goto   end  

:end  
echo  good bye



此文件运行后,将显示 defrag,mem,end[D,M,E]? 用户可选择d m e ,然后if语句将作出判断,d表示执行标号为defrag的程序段,m表示执行标号为mem的程序段,e表示执行标号为end的程序段,每个程序段最后都以goto end将程序跳到end标号处,然后程序将显示good bye,文件结束。

however , 在windows xp 下试验的时候发现choice 命令
  'choice' is not recognized as an internal or external command,operable program or batch file.
是不是还要在system32下添加什么choice.com或choice.exe? 晕。。。累了,call it a day!

As an AI language model, I can provide you with some information about CET-6 oral test. CET-6 is an English proficiency test in China, which is similar to TOEFL or IELTS. The oral test is one of its five parts, including listening, reading, writing, translation, and oral. The CET-6 oral test is designed to evaluate the candidate's ability to communicate effectively in English, with a focus on fluency, pronunciation, grammar, and vocabulary. The CET-6 oral test usually lasts for about 15 minutes, during which the candidate will have to answer a series of questions related to everyday topics, such as hobbies, family, work, and travel. The questions are designed to test the candidate's ability to express themselves in English, using appropriate grammar and vocabulary. The CET-6 oral test is conducted in a one-on-one interview format, with a qualified examiner who will assess the candidate's performance based on a set of criteria. The examiner will evaluate the candidate's ability to communicate effectively, with an emphasis on their fluency, coherence, and accuracy. To prepare for the CET-6 oral test, candidates should practice speaking English as much as possible, read English newspapers or magazines, watch English movies or TV shows, and listen to English radio or podcasts. It is also recommended to take mock exams and get feedback from professional teachers or tutors. Overall, the CET-6 oral test is an important component of the CET-6 exam, and candidates should take it seriously in order to achieve a high score and demonstrate their English proficiency.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值