最近,被公司派到前台实习收款,有点郁闷。无聊至极,突然发现收款的机子中有一台安了win2000(其他都是98),给了我一点小小的安慰,至少这里的计算机技术是进步的。
在领导不在的时候我凑到win2000的旁边,虽然没有xp使用顺手,至少同98比起来是很好的。哈哈,这让我想起了,唐伯虎喊“美女”的时候,秋香与众人一同回头的情景。吓煞我也!
不徐了,说正题。
通过使用dos基本命令编写一个.bat的批处理程序,通过这个批处理程序输出help列出的命令的使用方法。该批处理文件的基本框架如下:
1.创建1.txt文件,保存第一条命令的含义和参数的使用方法。
2.创建2.txt文件,保存第二条命令的含义和参数的使用方法。
3.将文件1.txt和2.txt合并保存到文件1.txt。
4.输出命令之间的分割符到文件2.txt。
5.将文件1.txt和2.txt合并保存到文件1.txt。
6.对其他命令的具体含义进行输出操作,与上类似。
7.所有命令输出完后,删除文件2.txt。把文件1.txt改名。
通过上述流程可以很方便的得到help命令所列出的所有命令的含义和使用方法。下面是.bat批量文件的全部内容:
help ASSOC >1.txt
help AT >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help ATTRIB >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help BREAK >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help CACLS >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help CALL >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help CD >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help CHCP >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help CHDIR >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help CHKDSK >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help CHKNTFS >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help CLS >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help CMD >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help COLOR >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help COMP >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help COMPACT >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help CONVERT >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help COPY >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help DATE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help DEL >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help DIR >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help DISKCOMP >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help DISKCOPY >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help DOSKEY >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help ECHO >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help ENDLOCAL >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help ERASE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help EXIT >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help FC >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help FIND >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help FINDSTR >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help FOR >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help FORMAT >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help FTYPE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help GOTO >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help GRAFTABL >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help HELP >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help IF >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help LABEL >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help MD >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help MKDIR >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help MODE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help MORE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help MOVE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help PATH >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help PAUSE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help POPD >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help PRINT >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help PROMPT >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help PUSHD >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help RD >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help RECOVER >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help REM >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help REN >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help RENAME >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help REPLACE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help RMDIR >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help SET >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help SETLOCAL >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help SHIFT >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help SORT >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help START >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help SUBST >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help TIME >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help TITLE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help TREE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help TYPE >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help VER >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help VERIFY >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help VOL >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
help XCOPY >2.txt
copy 1.txt+2.txt 1.txt
echo --------------------------------------------------------------------- >2.txt
copy 1.txt+2.txt 1.txt
del 2.txt
ren 1.txt win2000_command.txt
拷贝以上内容并保存为.bat文件,双击后即可得到win2000_command.txt文件,其中的内容一看便知,这里就不多说了,下面简单介绍一下批处理文件中使用到的命令。
help ASSOC >1.txt //输出命令ASSOC的含义到1.txt,与 ASSOC/? >1.txt 的效果是一样的
copy 1.txt+2.txt 1.txt //把文件2.txt中的内容追加到1.txt后
echo --------------------------------------------------------------------- >2.txt //输出一行分割符到文件2.txt
由于运行后所得win2000_command.txt文件中的内容太多,所以将另建文件叙述。如果批处理程序连续运行两次(期间没有删除第一次运行的结果文件win2000_command.txt),将在第二次运行后产生另一个新文件1.txt,其内容与第一次运行的结果文件相同。这是由于第一次运行后没有删除产生的结果文件win2000_command.txt,所以在对第二次运行后的结果文件改名时因为已经存在一个win2000_command.txt文件所以改名不成功,系统会抛出异常,改名不成功,所以就多了改名前的结果文件。
以上内容在xp中同样可用,xp中help所列出的命令与2000是相同的。