收藏 分享(赏)

十分钟让你看懂批处理.pdf

上传人:weiwoduzun 文档编号:3152881 上传时间:2018-10-04 格式:PDF 页数:88 大小:2.50MB
下载 相关 举报
十分钟让你看懂批处理.pdf_第1页
第1页 / 共88页
十分钟让你看懂批处理.pdf_第2页
第2页 / 共88页
十分钟让你看懂批处理.pdf_第3页
第3页 / 共88页
十分钟让你看懂批处理.pdf_第4页
第4页 / 共88页
十分钟让你看懂批处理.pdf_第5页
第5页 / 共88页
点击查看更多>>
资源描述

1、十分钟让你看懂批处理 张长青 软件设计二部目录 一、批处理是什么? 二、批处理能干什么? 三、批处理基本语法 四、批处理进阶之路一、批处理是什么?1、概念 (Batch) bat DOS DOS DOS 2、释义 DOS Windows DOS Windows COMMAND. COM CMD.EXE Unix Shell .bat .cmd if for goto C Basic 3、编写 DOS Edit WPS DOS Copy copy con Windows 4、执行 Microsoft .bat .cmd Microsoft DOS Windows 5、示例 Hello World

2、 1 test.txt bat 2 test.bat echo off echo Hello World pause 3 test.bat cmd test.bat 6、优点 二、批处理能干什么用途简介 Batch File BAT DOS DOS 1 、DOS 内置命令功能2 、DOS 调用外部命令功能3、排列组合 外部命令 内部命令 外部命令 程序逻辑 内部命令 if 判断 for 循环4、主要用途 批量执行命令 系统管理 文件处理 字符串处理三、批处理基本语法1、常用命令 echo echo echo on|off message echo off / echo hello world

3、1、常用命令 rem C /*-*/ Rem Rem : rem rem rem : rem :1、常用命令 pause Pause Press any key to continue. . . . . .) pause echo . pause 1、常用命令 call call Call call Drive:Path FileName call c:test.bat1、常用命令 start DOS start start MIN SEPARATE 16 Windows HIGH HIGH REALTIME REALTIME WAIT parameters / startcalc.exe W

4、indows 1、常用命令 goto goto label label :1 start goto 1 goto 1、常用命令 set set set s s set var=value var value set aa=abcd aa abcd set aa= aa aa aa aa C int float char set aa=345 aa 345 345 set 2、符号简介 pause pause 2、符号简介 echo aaaaaa.txt aaaaa a.txt a.txt a.txt aaaaa a.txt a.txt aaaaa echo aaaaaa.txt echo aa

5、aaaa.txt a.txt a.txt a.txt a.txt a.txt aaaaa a.txt 2、符号简介 2、符号简介 | command_1|command_2 2、符号简介 | & echo echo 2、符号简介 & & | & n DOS & & | | 3、命令释义 cd md rd dir tree path copy 3、命令释义 type copy del move ren replace attrib find fc 3、命令释义 ping ftp net telnet ipconfig TCP/IP msg arp IP - 3、命令释义 at shutdown

6、tskill taskkill tskill WinXPHome tasklist Windows XP Home Edition sc reg powercfg 3、命令释义 CMD help help 4、语句结构 C if for 4、语句结构 if 语句 if if if 4、语句结构 if 语句 1 if if not string1 compare-op string2 command1 else command2 compare-op = - EQU - NEQ - LSS - LEQ - GTR - GEQ - /i not 4、语句结构 if 语句 1 set str1=ab

7、cd1233 set str2=ABCD1234 if %str1%=%str2% (echo ) else (echo )4、语句结构 if 语句 2 IF NOT EXIST filename command1 else command2 if exist %0 echo %0 if not exist %df0 ( echo %df0 else echo %df0 pausenul4、语句结构 if 语句 2 %0 %df0 %0 for /? if command1 if else command1 command2 else command1 command2 command 4、语

8、句结构 if 语句 3 IF not DEFINED variable command1 else command2 4、语句结构 if 语句 4 number 0255 IF not errorlevel number command1 else command2 4、语句结构 for 语句 for for C for for 4、语句结构 for 语句 1 for for FOR %variable IN (set) DO command %variable DOS %variable % set C do command 4、语句结构 for 语句 1 4、语句结构 for 语句 2 /

9、L /L for set FOR /L %variable IN (start,step,end) DO command start step end end start step4、语句结构 for 语句 2 /L 4、语句结构 for 语句 3 /F /F for ASCII txt FOR /F “options“ %variable IN (set) DO command set “string“ command file-set options eol=c skip=n delims=xxx tokens=x,y,m-n usebackq for /f skip tokens del

10、ims 4、语句结构 for 语句 3 /F 4、语句结构 for 语句 4 /D /R /D /R for /R for 5、字符串 C 5、字符串 1 %a:m,n% % a m 0 n 5、字符串 1 5、字符串 2 %PATH:str1=str2% %PATH% str1 str25、字符串 2 5、字符串 3 5、字符串 4 I - “) %I %fI - %I %dI - %I %pI - %I %nI - %I %xI - %I %sI - %aI - %I %tI - %I / %zI - %I 5、字符串 4 6、数值计算 32 0x80000000h0x7FFFFFFFh

11、-2147483648+2147483647 set set /a expression expression C set C 6、数值计算 set - - * / % - + - & - | = *= /= %= += -= - &= = |= = set 6、数值计算 % set /a set 0 0x set /a a=123+0123+0x123 7、变量 , “ “ “ “ 7、变量 1 CMD set 7、变量 1 7、变量 1 %0 %1 %2 %3 %4 %5 %9 %* %0 , , %1-%9 . %1 %2 %3-%9 %* 7、变量 1 7、变量 2 C set :8、参数 C 8、参数 1 call 8、参数 2 call

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报