批处理【珍藏】批处理常用指令([collection] common instructions for batch processing)

批处理for  时间:2021-03-25  阅读:()

【珍藏】批处理常用指令 [collection] common instructions forbatch processing

BAT command Daquan

@ # single back off

Echo off # began to close back from the next line

@echo off#began to close back from the bank. This is the firstline of general batch processing

Echo on # began to open to the next line

Echo echo off is # displays the current state or echo state onEcho. # output a blank line, "enter"

# (echo, echo; echo+ echo[echo] echo/ echo\)

2 errorlevel

Echo%errorlevel%

Each command is run and you can view the return code in thiscommand line format

The default value is 0, and the general command error is setto errorlevel 1

3 dir

Dir#displays the current directory files and subdirectories.Dir /a # display in the current directory files andsubdirectories, including hidden and system files

Dir c: /a:d # display C in the current directory directoryDir c: /a:-d # display root directory C files

Dir c:\/b/p#/b displays only the file name, and the /p pagingdisplay

Dir *.exe /s # display the current directory and all thesubdirectories.Exe file

4 CD

Cd\ # into the root directory

CD # displays the current directory

CD /d d:\sdk # can also change the drive and directory5 MD

MD d:\a\b\c # if d:\a does not exist, it will automaticallycreate the intermediate directory

If # command extensions are disabled, you need to type MKDIR\a\b\c.

6 Rd

Rd ABC# delete the current directory ABC directory, for emptydirectory

Rd/s/q d:\temp# delete the d:\temp folder and subfolders andfiles, /q quiet mode

7 del

Del d:\test.txt # deletefile, cannot be hidden, and read-onlyfile system

Del /q/a/f d:\temp\*.*

Delete all files inside the d:\temp folder, including hidden,read-only, system files, not subdirectories

Del /q/a/f/s d:\temp\*.*

Delete all files in the d:\temp and subfolders, includinghidden, read-only, system files, not subdirectories

8 Ren

Ren d:\temp TMP # support to rename folder

9 CLS

Clear the screen

10 type

Display file contents

Type c:\boot. ini#displays the contents of the specified file,the program files usually garbled

Type *. txt # display all.Txt files in the current directorycontents

11 copy

Copy file

Copy c:\test. txt d:\test.bak

Copy the c:\test.txt file to d:\ and rename it to test.bakCopy con test.txt

From the screen, wait for the input, press Ctrl+Z to end theinput, and save the input as a test. txt file

Con stands for screen, PRN stands for printer, and nul standsfor empty device

Copy 1. txt + 2.txt 3.txt

Merge the contents of 1.txt and 2. txt and save it as a 3.txtfile

If no 3.txt is specified, then save to 1.txt

Copy test. txt +

Copying files to themselves is actuallymodifying the file date12 title

Set the title of the CMD window

Title New Title # CMD can see the title bar of the windowchanged.

13 ver

Display system version

14 label and Vol

Set the label

Vol # display label

Label # display label, also prompted the new label

Label c:system # set C label for system

15 pause

Pause command

16 REM and: :

Comment command

The comment line does not perform the operation

17 date and time

Date and time

Date#displays the current date, and prompted a new input date,press "enter" skip

Date/t#only displays the current date, not prompt the new dateTime # displays the current time, and prompt new input time,press "enter" skip

Time/t # only display the current time, not prompted to entera new time

18 goto and:

Jump command

Label: the # said it is tag line, the tag line does not performthe operation

Goto label # jump to the specified label that line

19 find (external command)

Find command

Find \ \ "abc\" c:\test.txt

Find the line containing theABC string in the c:\test.txt fileIf not found, the errorlevel return code is set to 1

Find /i, "ABC", c:\test.txt

Find rows containing ABC, ignore case

"Find /c \" "abc\" c:\test.txt

Shows the number of rows containing ABC

20 more (external command)

Screen by screen display

More c:\test. txt # by screen display c:\test. txt file content21 tree

Display directory structure

Tree d:\ # display D disk file directory structure

22 &

Execute multiple commands in sequence, regardless of whetherthe command succeeds

23 & &

Execute multiple commands in sequence, and do not execute thefollowing command when the command that executes the error isencountered

Find "ok\" c:\test. txt & & echo

If the word "ok\" is found, it is shown "success" and cannotbe found if it is not found

24 | |

Execute multiple commands in sequence, and do not execute thefollowing command when the correct command is encounteredFind "ok\" c:\test. txt echo | | unsuccessful

If the word "ok\" is not found, it is shown "unsuccessful \"and is not displayed when it is found

25 |

Pipe command

Dir /s/a find /c. * | \ ".Exe\"

The pipe command indicates that the dir command is executedfirst, and the subsequent find command is executed for theoutput of the command

The command line results: output the number of.Exe files in thecurrent folder and all subfolders

Type c:\test. txt|more

This is the same effect as the more c:\test.txt

26 > an d

Output redirection command

> purge the original contents of the file before writing themAppend content to the end of the file without removing theoriginal content

The main contents of the original display on the screen isoutput to the specified file

If the specified file does not exist, the file is automaticallygenerated

Type c:\test. txt >prn

The file content is not displayed on the screen, and the outputis turned to the printer

触碰云高性价20.8元/月,香港云服务器,美国cn2/香港cn2线路,4核4G15M仅115.2元/月起

触碰云怎么样?触碰云是一家成立于2019年的商家。触碰云主营香港/美国 VPS服务器、独立服务器以及免备案CDN。采用的是kvm虚拟构架,硬盘Raid10,Cn2线路,去程电信CN2、移动联通直连,回程三网CN2。最低1核1G带宽1M仅20.8元/月,不过这里推荐香港4核4G15M,香港cn2 gia线路云服务器,仅115.2元/月起,性价比还是不错的。点击进入:触碰云官方网站地址触碰云优惠码:优...

数脉科技:香港服务器低至350元/月;阿里云CN2+BGP线路,带宽10M30M50M100M

数脉科技(shuhost)8月促销:香港独立服务器,自营BGP、CN2+BGP、阿里云线路,新客立减400港币/月,老用户按照优惠码减免!香港服务器带宽可选10Mbps、30Mbps、50Mbps、100Mbps带宽,支持中文本Windows、Linux等系统。数脉香港特价阿里云10MbpsCN2,e3-1230v2,16G内存,1T HDD 或 240G SSD,10Mbps带宽,IPv41个,...

柚子互联(34元),湖北十堰高防, 香港 1核1G 5M

柚子互联官网商家介绍柚子互联(www.19vps.cn)本次给大家带来了盛夏促销活动,本次推出的活动是湖北十堰高防产品,这次老板也人狠话不多丢了一个6.5折优惠券而且还是续费同价,稳撸。喜欢的朋友可以看看下面的活动详情介绍,自从站长这么久以来柚子互联从19年开始算是老商家了。六五折优惠码:6kfUGl07活动截止时间:2021年9月30日客服QQ:207781983本次仅推荐部分套餐,更多套餐可进...

批处理for为你推荐
操作http湖北省网易yeah操作httpinternalservererrorHTTP/1.1500Internal Server Error.怎么办呐accessdenied升级后出现Access denied 如何解决进入查看360和搜狗360浏览器和搜狗浏览器哪个好用?asp.net什么叫ASP.NET?163yeahyeah邮箱和163邮箱的区别在哪里 那个好用重庆电信dns重庆电信的DNS是什么加多宝和王老吉王老吉和加多宝的关系?
到期域名查询 php空间租用 免费申请网站域名 草根过期域名 t楼 pccw 美国便宜货网站 日志分析软件 搜狗抢票助手 tightvnc 免费博客空间 远程登陆工具 京东商城0元抢购 卡巴斯基试用版 河南移动网 免费私人服务器 便宜空间 vul 石家庄服务器托管 lamp架构 更多