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

月神科技-美国CERA 5折半价倒计时,上新华中100G高防云59起!

官方网站:点击访问月神科技官网优惠码:美国优惠方案:CPU:E5-2696V2,机房:国人热衷的优质 CeraNetworks机房,优惠码:3wuZD43F 【过期时间:5.31,季付年付均可用】活动方案:1、美国机房:洛杉矶CN2-GIA,100%高性能核心:2核CPU内存:2GB硬盘:50GB流量:Unmilited端口:10Mbps架构:KVM折后价:15元/月、150元/年传送:购买链接洛...

欧路云:美国CUVIP线路10G防御,8折优惠,19元/月起

欧路云新上了美国洛杉矶cera机房的云服务器,具备弹性云特征(可自定义需要的资源配置:E5-2660 V3、内存、硬盘、流量、带宽),直连网络(联通CUVIP线路),KVM虚拟,自带一个IP,支持购买多个IP,10G的DDoS防御。付款方式:PayPal、支付宝、微信、数字货币(BTC USDT LTC ETH)测试IP:23.224.49.126云服务器 全场8折 优惠码:zhujiceping...

TNAHosting($5/月)4核/12GB/500GB/15TB/芝加哥机房

TNAHosting是一家成立于2012年的国外主机商,提供VPS主机及独立服务器租用等业务,其中VPS主机基于OpenVZ和KVM架构,数据中心在美国芝加哥机房。目前,商家在LET推出芝加哥机房大硬盘高配VPS套餐,再次刷新了价格底线,基于OpenVZ架构,12GB内存,500GB大硬盘,支持月付仅5美元起。下面列出这款VPS主机配置信息。CPU:4 cores内存:12GB硬盘:500GB月流...

批处理for为你推荐
css加载失败网易邮箱登陆显示CSS加载失败,怎么办?急,在线等。开启javascript怎样手动开启Javascript企业电子邮局企业邮箱怎么使用?波音737起飞爆胎一般的客机的起飞速度是多少?重庆400年老树穿楼生长生长百年的老树,仍能不断生长,是因为主要有什么组织什么是支付宝支付宝是什么意思?internetexplorer无法打开Internet Explorer 无法打开?sns网站有哪些中国都有哪些sns网站?还有它们都是哪个类型的?抢米网抢小米手机需要下什么软件 速求银花珠树晓来看关于下雪景的诗句
武汉域名注册 美国linux主机 vps论坛 缓存服务器 徐正曦 域名评估 域名接入 qq云端 100mbps 新世界服务器 shuang12 hostease 中国电信宽带测速 wordpress空间 湖南铁通 hosting24 美国asp空间 sonya 中美互联网论坛 so域名 更多