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

久久网云-目前最便宜的国内,香港,美国,日本VPS云服务器19.9元/月起,三网CN2,2天内不满意可以更换其他机房机器,IP免费更换!。

久久网云怎么样?久久网云好不好?久久网云是一家成立于2017年的主机服务商,致力于为用户提供高性价比稳定快速的主机托管服务,久久网云目前提供有美国免费主机、香港主机、韩国服务器、香港服务器、美国云服务器,香港荃湾CN2弹性云服务器。专注为个人开发者用户,中小型,大型企业用户提供一站式核心网络云端服务部署,促使用户云端部署化简为零,轻松快捷运用云计算!多年云计算领域服务经验,遍布亚太地区的海量节点为...

sharktech:老牌高防服务器商,跳楼价,1G独享$70、10G共享$240、10G独享$800

不知道大家是否注意到sharktech的所有服务器的带宽价格全部跳楼跳水,降幅简直不忍直视了,还没有见过这么便宜的独立服务器。根据不同的机房,价格也是不一样的。大带宽、不限流量比较适合建站、数据备份、做下载、做流媒体、做CDN等多种业务。 官方网站:https://www.sharktech.net 付款方式:比特币、信用卡、PayPal、支付宝、西联汇款 以最贵的洛杉矶机器为例,配置表如...

RackNerd 黑色星期五5款年付套餐

RackNerd 商家从2019年上线以来争议也是比较大的,一直低价促销很多网友都认为坚持时间不长可能会跑路。不过,目前看到RackNerd还是在坚持且这次黑五活动也有发布,且活动促销也是比较多的,不过对于我们用户来说选择这些低价服务商尽量的不要将长远项目放在上面,低价年付套餐服务商一般都是用来临时业务的。RackNerd商家这次发布黑五促销活动,一共有五款年付套餐,涉及到多个机房。最低年付的套餐...

批处理for为你推荐
重庆400年老树穿楼生长重庆轻轨穿过居民楼在哪里,从解放碑怎么去360公司迁至天津奇虎360公司在哪?设计eset购物车在超市、商场中为什么需要使用购物车呢?易名网易名网交易域名是怎么收费的电子商务世界电子商务最先起源于那个国家,什么时间厦门三五互联科技股份有限公司厦门三五互联科技股份有限公司广州分公司 待遇怎么样啊,电话营销的可信网站可信网站认证一定要办吗武林官网欢go客户端一般在哪里下载是官方的?如何发帖子怎么发帖啊
长沙域名注册公司 最便宜虚拟主机 站群服务器 鲜果阅读 申请空间 cpanel空间 vip购优惠 下载速度测试 免费ftp 华为k3 阿里云邮箱登陆地址 cdn网站加速 阿里云邮箱个人版 cdn服务 乐视会员免费领取 hdroad accountsuspended websitepanel 阿里云宕机故障 火山互联 更多