当前位置:网站首页>Bat instruction processing details
Bat instruction processing details
2022-07-07 05:45:00 【45 degrees look at me】
bat Instructions processing details -1
One : bat Document understanding
windows Next BAT The working principle of batch processing is to process multiple items at a time DOS command , Its effect is similar to that in DOS Next, execute each command in sequence ;BAT A file is actually a text file , It can be opened with any text editor .
windows With the help of bat file , be relative to –Linux With the help of shell Script can complete many operation steps, but the operation order is the same , And the whole process needs to be repeated many times
Two : dos Order to organize
1> dos command help
cmd Interface direct input ---》help Following commands
Common commands | meaning |
---|---|
CD | Display or change the name of the current directory . |
CHDIR | Display or change the name of the current directory . |
BREAK | Set or clear extended CTRL+C Check . |
DATE | Show or set the date |
DIR | Show files and subdirectories in a directory |
ECHO | display messages , Or turn the command echo on or off |
EXIT | sign out CMD.EXE Program ( Command interpreter ) |
FIND | Search for a text string in one or more files . |
FINDSTR | Search multiple files for Strings . |
HELP | Provide Windows Command help information . |
PATH | Display or set search path for executable file . |
PAUSE | Pause batch file processing and display message . |
ENDLOCAL | End localization of environment changes in batch file . |
TIME | Display or set system time . |
CLS | Clear the screen |
SYSTEMINFO | Displays the specific properties and configuration of the computer . |
COLOR | Set default console foreground and background colors . |
File or directory commands | meaning |
---|---|
COPY | Copy at least one file to another location . |
MD | Create a directory . |
RD | Delete directory . |
MKDIR | Create a directory . |
MKLINK | Create symbolic links and hard links |
MODE | Configure system devices . |
MORE | Screen by screen display output . |
MOVE | Move one or more files from one directory to another . |
COMP | Compare the contents of two or two sets of documents |
OPENFILES | Displays files opened by remote users for file sharing . |
DEL | Delete at least one file . |
ERASE | Delete one or more files . |
FC | Compare two files or two file sets and display The difference between them . |
RECOVER | Recover readable information from a damaged or defective disk . |
REN | Rename file . |
RENAME | Rename file . |
REPLACE | Replace file . |
RMDIR | Delete directory . |
ROBOCOPY | Advanced utility for copying files and directory trees |
dos Command statement | meaning |
---|---|
CALL | Call this one from another batch program . |
IF | Performing conditional processing operations in a batch program . |
SET | Show 、 Set or delete Windows environment variable . |
SORT | Sort input . |
FOR | Run a specified command for each file in a set of files . |
GOTO | take Windows The command interpreter directs to a labeled line in the batch program . |
SETLOCAL | Start localizing environment changes in batch files . |
START | Start a separate window to run the specified program or command . |
TASKLIST | Show all currently running tasks including services . |
TASKKILL | Abort or stop a running process or application . |
TYPE | Display the contents of the text file . |
Print a text file . |
Other commands | meaning |
---|---|
TITLE | Set up CMD.EXE The window title of the session . |
TREE | Graphically displays the directory structure of the driver or path . |
VER | Show Windows Version of . |
CHCP | Display or set the number of active code pages . |
CHKDSK | Check the disk and display the status report . |
ASSOC | Show or modify file extension associations . |
CHKNTFS | Displays or modifies the startup time disk check . |
ATTRIB | Show or change file properties . |
CMD | Open another Windows Command interpreter window . |
BCDEDIT | Set the properties in the startup database to control the boot load . |
CACLS | Display or modify the access control list of a file (ACL). |
COMPACT | Show or change NTFS Compression of files on partitions . |
CONVERT | take FAT The volume is converted to NTFS. You cannot convert the current drive . |
DISKPART | Display or configure partition properties . |
DOSKEY | Edit the command line 、 withdraw Windows Command and create a macro . |
DRIVERQUERY | Displays the current device driver status and properties . |
FSUTIL | Display or configure file system properties . |
FTYPE | Displays or modifies the file type used in the file extension Association . |
FORMAT | Format disk , In order to be used for Windows. |
GPRESULT | Displays group policy information for a computer or user . |
GRAFTABL | send Windows Displays the extended character set in graphics mode . |
LABEL | establish 、 Change or delete the label of the disk . |
ICACLS | Show 、 modify 、 Back up or restore files and directories ACL. |
POPD | Reduction by PUSHD The last value of the saved current directory . |
SCHTASKS | Arrange to run commands and programs on a computer . |
SHIFT | Adjust the position of replaceable parameters in the batch file . |
SHUTDOWN | Allow proper shutdown of the computer locally or remotely . |
PROMPT | change Windows Command prompt . |
PUSHD | Save the current directory , Then change it . |
SC | Display or configure services ( Background processes ). |
SUBST | Associate a path with a drive letter . |
VERIFY | tell Windows Whether to verify , To ensure that the file is correctly written to disk . |
VOL | Display the disk volume label and serial number . |
XCOPY | Copy files and directory trees . |
WMIC | In interactive commands shell It shows that WMI Information . |
REM | Record batch files or CONFIG.SYS The comments in ( Comments ). |
2> dos The command uses the query
dos_command -help(-h)
1. Parameter transmission command –COLOR -H
Set the default console foreground and background colors .
COLOR [attr]
attr Specifies the color attribute of the console output .
The color attribute is specified by two hexadecimal digits -- first
Corresponding to the background , The second corresponds to the foreground . Every number
Can be any of the following values :
0 = black 8 = gray
1 = Blue 9 = Light blue
2 = green A = Light green
3 = Light green B = Light green
4 = Red C = Light red
5 = violet D = lavender
6 = yellow E = canary yellow
7 = white F = Bright white
If no parameters are given , This command restores the color to CMD.EXE Startup time
The color of the . This value comes from the current console
window 、/T Command line switch or DefaultColor The registry
value .
If you try to use the same
Foreground and background colors to perform
COLOR command ,COLOR Command will ERRORLEVEL Set to 1.
Example : "COLOR fc" Produce a light red on bright white
DEMO
COLOR 72# background 7 = white , typeface 2 = green
2. Query instructions SYSTEMINFO
C:\Users\CHH_PC>SYSTEMINFO
Host name : DESKTOP-T164P4E
OS name : Microsoft Windows 10 pro
OS edition : 10.0.19044 For the moment Build 19044
OS Manufacturer : Microsoft Corporation
OS To configure : Stand alone workstations
OS Construction type : Multiprocessor Free
Registered owners : CHH_PC
Registered organizations : For the moment
product ID: 00331-20020-00000-AA583
Initial installation date : 2022/4/15, 20:25:43
System start time : 2022/6/25, 0:02:32
System manufacturers : Dell Inc.
System model : Inspiron 7472
System type : x64-based PC
processor : Installed 1 A processor .
[01]: Intel64 Family 6 Model 142 Stepping 10 GenuineIntel ~1600 Mhz
3. DOS The encoding format of the window
936 It is the coding format set by Microsoft for China , Of course , We can also modify the coding format
chcp Code format code
# This is only a temporary modification to the encoding format of the current file , When this DOS After the window closes, it will revert to the original encoding format
Code | Coding format |
---|---|
950 | Traditional Chinese |
65001 | UTF-8 |
936 | Simplified Chinese default GBK |
437 | MS-DOS American English |
1253 | Greek |
1258 | Vietnamese |
1256 | The Arabic language |
3、 ... and : bat Grammar introduction
1> Auxiliary order
1. notes
** : : Start with a single colon ; Be regarded as a label , And directly ignore all the following contents ;
Valid label : A colon followed by an alphanumeric string ,goto Statement can recognize ;
Invalid label : Colon followed by a string that does not begin with an alphanumeric ,goto Statement unrecognized ; Can play a comment about ; As a habit ** :: ** It is often used as an annotation symbol , In fact, the latter one ** : ** It can be replaced with any character, and it can also play a comment effect , Such as ::+** 、 :* …
REM:‘ Comment order ’, Generally used to give programs ’ Add annotations ’, What follows this command ’ Not to be carried out , but ’ Can echo ;
% The comment % : For inline comments , Rarely used , Use with caution ;
notes | difference |
---|---|
:: | Cannot echo , Is considered invalid |
REM or rem | Not to be carried out , Can echo , Can be used for config.sys file |
2. echo The echo
Close back display : Refer to ’ Run batch file ’ when ,‘ No display ’ In the file ’ Every command ’, Display only ’ Running results ’;
@echo off # from ’ Start of the bank ’ Close back display ---- General batch processing ’ first line ’ It's all this
C:\Users\CHH_PC>echo /?
display messages , Or turn command echo on or off .
ECHO [ON | OFF]
ECHO [message]
To display the current echo settings , Please type... Without parameters ECHO.
==========================================
echo off : Display the execution path , Execute command is not displayed , Direct display of content
echo on: Display the execution path , Display the execution command and display the content ,
@echo off : Do not display the execution path , Execute command is not displayed , Direct display of content
usage :
A:echo coordination @ \off\on Turn off and turn on echo
B:echo Followed by a space and a character , Echo string information function ;
C: echo Following the .|, The pipe symbol can be followed by the command to echo ;
C:\Users\CHH_PC>echo.|time
current time : 22:35:19.42
Enter a new time :
bat Content
@echo off
echo.|SYSTEMINFO
pause
D: echo Generate files and write information ;
echo a test file. >1.txt # Generate the file here and write the content , And a test file. There is a space after ;
echo a test file.>1.txt# Generate the file here and write the content , And a test file. No space after ; because **file.>1** , There is no space at the connection ;
echo a test file.>>1.txt# Generate the file here and write the content or append the content after the file content ;
E:echo Make the computer sound to prompt ;
voice | command |
---|---|
Beep | echo pause>nul |
3. pause
Running this sentence pauses the execution of the batch and displays Press any key to continue… A hint of , Wait for the user to press any key before continuing ;
2> File processing command
1. ren Rename file
ren 1.png 2.png # first_file target_file
3> Execute statement command
1. if Judge
边栏推荐
- Flink SQL realizes reading and writing redis and dynamically generates hset key
- What are the common message queues?
- make makefile cmake qmake都是什么,有什么区别?
- 1.AVL树:左右旋-bite
- Paper reading [semantic tag enlarged xlnv model for video captioning]
- AI face editor makes Lena smile
- The 2022 China low / no code Market Research and model selection evaluation report was released
- Initial experience of annotation
- 分布式事务解决方案之TCC
- 三级菜单数据实现,实现嵌套三级菜单数据
猜你喜欢
Dj-zbs2 leakage relay
随机生成session_id
消息队列:如何确保消息不会丢失
TCC of distributed transaction solutions
论文阅读【Sensor-Augmented Egocentric-Video Captioning with Dynamic Modal Attention】
Flink SQL realizes reading and writing redis and dynamically generates hset key
Dynamic memory management
Paper reading [MM21 pre training for video understanding challenge:video captioning with pre training techniqu]
京东商品详情页API接口、京东商品销量API接口、京东商品列表API接口、京东APP详情API接口、京东详情API接口,京东SKU信息接口
Realize GDB remote debugging function between different network segments
随机推荐
Tablayout modification of customized tab title does not take effect
Leakage relay jelr-250fg
Paper reading [MM21 pre training for video understanding challenge:video captioning with pre training techniqu]
MySQL-CentOS7通过YUM安装MySQL
毕业之后才知道的——知网查重原理以及降重举例
【Shell】清理nohup.out文件
Codeforces Round #416 (Div. 2) D. Vladik and Favorite Game
Message queue: how to deal with message backlog?
Initial experience of annotation
The year of the tiger is coming. Come and make a wish. I heard that the wish will come true
App clear data source code tracking
1. AVL tree: left-right rotation -bite
Taobao store release API interface (New), Taobao oauth2.0 store commodity API interface, Taobao commodity release API interface, Taobao commodity launch API interface, a complete set of launch store i
基于NCF的多模块协同实例
2pc of distributed transaction solution
纪念下,我从CSDN搬家到博客园啦!
I didn't know it until I graduated -- the principle of HowNet duplication check and examples of weight reduction
Egr-20uscm ground fault relay
Make web content editable
Leakage relay llj-100fs