teaches you how to write your own bat file. (with several useful bat files): H + \! G c, q# \}
Let's give a simple example:
Let the computer shut down at a specified time every day, you can use the following method 8 B2 v2 ~) J6] T
, B9 c) A, Z, '
Open Notepad and write the following:% s:t "O0 S1 B3 z6 P" O
, Z:z (j! R, O6 E
At 22:59 shutdown-s-f-t 3; X w& k$ K Y. D7 T7 Q
: J, h/b0 C "G
Save as Shutdown.bat file, double click to execute (if you want to do this every day, put it in the Startup folder) 3]+ Y! i/u& W-n8 Z:g
% L ' l/k# u# x* e& v# n# w-r$ p
http://soft.deepin.org/read.php?tid=35126&keyword=
Here's a common command for bat: m+ [$/Y) S. M1 F
Echo, @, call, pause, REM (tip: Use:: Instead of REM) are some of the most common commands for batch files, and we start with them. (@ R. E. N "l& L (T. N7]
= = = =========== 3 y$ o+ m$ _/P
First, @ is not a command, but rather a special token for the DOS batch, only for masking command-line echo. Here are some special tokens that you might see in a DOS command line or batch:
CR (0D) command line terminator
Escape (1B) ANSI escape character guide
Space (20) commonly used parameter qualifiers/@: z) z& w R6 E D0 @8 g$ r% O
Tab (09); = less commonly used parameter qualifier + G7 O1 h3 L1 D, J) D7 O
+ Copy command file connector
* ? File wildcard characters
\ "\" string delimiter 0 X9 p ' G. R $ \-X7 V7 U
| Command pipe character
< > >> file redirection * B6 T4 y; U,?! |7 C0 N
@ command-line echo mask; I5 A r+ Z6 f/e) \
/Parameter Switch guide
: Batch Label Guide
% Batch variable guide/I4 i#-J. P
Second,:: indeed can play the role of REM annotation, and more concise and effective; But there are two points to note:) q& p% {M7 T, M1 M
First, in addition to: outside, any of the following: The beginning of the word lines, in the batch is regarded as the label, and directly ignore all the contents thereafter, just to distinguish from the normal marking, we recommend using Goto is not recognized by the label, that is, immediately after a non-alphanumeric special symbol.
Second, unlike REM, the following character lines is not echoed at execution time, regardless of whether the command-line echo is turned on with Echo on, because the command interpreter does not consider him to be a valid command line, and for this point, REM will be more applicable in some cases than:: In addition, REM can be used in Config.sys files.
===================== (e#} (U S4 d-e
Echo indicates that the character after this command is displayed # ^/\6 A! w& Z2 H1 Q4 b* T
echo off means that all running commands do not display the command line itself after this statement 0 K1 x7 q& L5 e/j
@ with echo off, but it is added at the front of each command line, indicating that the runtime does not display this line of command line (only affects the current row).
Call calls another batch file (if the batch file is called directly without calling, the current file cannot be returned and subsequent commands for the current file are executed after the batch file is executed). + T; H ^1 J: _* p0 M
Pause running this sentence pauses the execution of the batch and displays the press any key to continue on the screen ... Prompt, waiting for the user to press any key to continue
REM indicates that the word identifier after this command is interpreted as a line (note), not executed, but for future reference (equivalent to comments in the program).
* = = =====
The description here is more confusing than the command line that directly refers to a command helps more coherently: @+ n$ g6 M |; K-u
-------------------------
ECHO
Displays or hides the body of the batch program when the program is running. can also be used to allow or suppress the echoing of commands.
/N9 B "q-l# ~, I
When you run a batch program, MS-DOS typically displays (echoes) commands in the batch program on the screen.
Use the echo command to turn this feature off. 0 ~% P2 ': S3 T8 L4-J
Syntax 5 e# p2 R i* o8 Y4 z! Q1 g% Z
$ Z! }) H ' V, O. R6 E
ECHO [on| OFF]
To display a command with the echo command, you can use the following syntax:
echo [Message]
Parameter/Y) Q2 x& B5 d/u0 o
on| OFF 8 A6 _) E ' 9} "x percent E
Specifies whether to allow echo of the command. To display the current echo settings, you can use the echo with no parameters
Command.
6 z+ ~* s T (x$ ~* O, |7 g
Message
Specifies the body to let MS-dos display on the screen. -C "B, Y2 E (v! o/x L
-------------------
Pager
Calls another batch program from one batch program without causing the abort of the first batch process.
9 U5 v ' 5 o* \ ' m]! ' * J
Grammar
Call [Drive:][path]filename [Batch-parameters] (W3 {!) U1 ~ Y
L (D (b "n# @1 E" U "b
Parameters
# q2 L8 H (T4 E "W
[Drive:] [Path]filename
Specifies the name of the batch program to invoke and where it is stored. The file name must be used. Bat as the extension.
Batch-parameters +}& h& x8 h7 V6 m
Specifies the command line information required by the batch program. 3 b-r2? 0 ' $ @) |
7 x2 |4? ' B + t:o6 N4]
-------------------------------
1 @4/X J _ ' Y; V5 ^
PAUSE
# @! x) w$ x& U0 H
Pauses execution of the batch program and displays a message prompting the user to press any key to continue execution. Only at the batch place! s/o ' J4 p-z. R0}
This command is used in the manager program.
Syntax: X2 O1 B; R3 M% H! L
6]$ R6 S3 q$ @$ W
PAUSE! a& Z3 I4 g% m$ u y "V
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.