批处理【珍藏】批处理常用指令([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

TabbyCloud周年庆&七夕节活动 美國INAP 香港CN2

TabbyCloud迎来一周岁的生日啦!在这一年里,感谢您包容我们的不足和缺点,在您的理解与建议下我们也在不断改变与成长。为庆祝TabbyCloud运营一周年和七夕节,TabbyCloud推出以下活动。TabbyCloud周年庆&七夕节活动官方网站:https://tabbycloud.com/香港CN2: https://tabbycloud.com/cart.php?gid=16购买链...

LightNode(7.71美元),免认证高质量香港CN2 GIA

LightNode是一家位于香港的VPS服务商.提供基于KVM虚拟化技术的VPS.在提供全球常见节点的同时,还具备东南亚地区、中国香港等边缘节点.满足开发者建站,游戏应用,外贸电商等应用场景的需求。新用户注册充值就送,最高可获得20美元的奖励金!成为LightNode的注册用户后,还可以获得属于自己的邀请链接。通过你的邀请链接带来的注册用户,你将直接获得该用户的消费的10%返佣,永久有效!平台目前...

LiCloud:香港CMI/香港CN2+BGP服务器,30Mbps,$39.99/月;香港KVM VPS仅$6.99/月

licloud怎么样?licloud目前提供香港cmi服务器及香港CN2+BGP服务器/E3-1230v2/16GB内存/240GB SSD硬盘/不限流量/30Mbps带宽,$39.99/月。licloud 成立於2021年,是香港LiCloud Limited(CR No.3013909)旗下的品牌,主要提供香港kvm vps,分为精简网络和高级网络A、高级网络B,现在精简网络和高级网络A。现在...

批处理for为你推荐
destoondestoon这个变量是啥意思?空间文章问问你知道我的空间有几篇文章啊?cisco2960cisco2960接入层交换机my.qq.commy.qq.com我是CF会员吗ipad代理苹果官网购买ipad要几天正大天地网天地网微信移动办公平台加多宝与王老吉王老吉和加多宝什么关系?开源网店开源网店系统 独立网店系统 淘宝 有什么区别?zencart模板zen cart模板怎么进行二次开发修改qq挂件QQ免费挂件怎么用
视频空间租用 俄罗斯vps vps虚拟服务器 老域名全部失效请记好新域名 美国php主机 evssl 魔兽世界台湾服务器 亚洲小于500m jsp空间 工信部icp备案号 老左正传 91vps 可外链相册 华为云服务登录 移动服务器托管 酸酸乳 阵亡将士纪念日 阿里云邮箱怎么注册 国外免费网盘 密钥索引 更多