China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 01:35
中国DOS联盟论坛 » WinPE、PowerShell及其它命令行系统专区 » CMD [Learning] View 16,767 Replies 48
Original Poster Posted 2008-01-28 10:01 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline

The tutorial will be continuously updated and supplemented later. Newcomers are kindly expected.
You are also welcome to join. plp626 is willing to discuss and share with you if there are new discoveries.


Blog--Study Notes
-------Suitable for those with certain foundation---------
~~~~~~~~~~~~~Pleaseguysdonotpostwaterposts!
Can-----> Put forward suggestions and opinions.
Can-----> Criticize!
Welcome-----> Point out mistakes!!!

~~~~~~~~~~~~~Thankyou!

Declaration: I can't say that all the codes in this post are original, but when citing, be sure to note from cn-dos.net

There are 71 built-in commands in cmd under Windows XP. Each command has its own help information. Now, first export all these helps to the cmdhelp directory on the desktop.
Here is a code:

@echo off&mode con lines=5 cols=50
md cmdhelp ||(pause&exit)
title Exporting cmd help information to the cmdhelp directory, please wait...
chcp 437>nul&call :help E
graftabl 936>nul&call :help C
cd cmdhelp
set mark=───────────────────────────────────
for %%i in (*.E) do (
echo.>>%%i &echo %mark%>>%%i
copy %%~ni.E+%%~ni.C EC_%%~ni.txt>nul
echo %mark%>>EC_%%~ni.txt &echo.>>EC_%%~ni.txt
)
del *.c;*.e
find /v "" *.txt>ALL.help
title Completed. Press any key to view. &pause>nul
start notepad ALL.help
goto :eof
:help
for /f %%i in ('help^|findstr "^"') do help %%i>>cmdhelp\%%i.%1
goto :eof


I still recommend reading the original English help. This combines the English version with the Chinese version. If your English is a bit poor, you can read them together.
I originally wanted to make it in htm format. I haven't figured it out yet. There are already people in the forum who have written relevant codes. You can search and refer to them to modify.
(P.S.: The relevant code has been given by ZJHJ on floor 17, you can refer to it)

The following post is what I wrote while learning. I will add more if I gain something, so modifications are inevitable. Some of the usages may not be explained in the help. These are mostly summarized by me from the predecessors in the forum.

Graspvariableinterception%str:~x,y% means: The offset of %str% is at position x, and the length is y characters.
~~~~~~~~~plp626 on 2008-1-28 ~~~~~~~~~~
start────────────────────────────────────────────────

Often need to use variable interception, so this command must be mastered proficiently. Here, x and y are positive and negative. There are a total of 4 situations. How are they intercepted respectively?
Do a small test, demonstrate the results at the command prompt:
echo off
set str=%date%
echo %str%
2008-01-28 星期一

This display result means that the value of variable %str% is "2008-01-28 星期一"
set a=%str:~2,4%
echo %a%
08-0

This means that starting from the right side of the 2nd character of %str%, intercept 4 characters backward. The value of variable %a% is this. The same below.
set b=%str:~6,-2%
echo %b%
1-28 星

Starting from the right side of the 6th character of %str%, intercept the remaining characters after discarding the last 2 characters of %str%. The value of variable %b% is this.
set c=%str:~-3,2%
echo %c%
星期

Starting from the left side of the 3rd character from the end of %str%, intercept 2 characters backward. The value of variable %c% is this.
set d=%str:~-6,-2%
echo %d%
28 星

Starting from the left side of the 6th character from the end of %str%, intercept the remaining characters after discarding the last 2 characters of %str%. The value of variable %d% is this.
-------------------------------------------------------------------------------------------------------------------------------
It is inconvenient to remember the above 4 situations. The important thing is to grasp the commonality. The following is my understanding (very unprofessional! Because I am not a computer major):

Observe the above 4 assignment statements and summarize to get the statement
set s=%str:~x,y%
The function is: Intercept characters with length y at offset x of string %str%, and assign to variable s.
Understanding and mastering:

Remember: Left->Right --- positive direction
Right->Left --- negative direction
When x is positive or 0, offset x means the right side of the x-th character along the positive direction.
When x is negative, offset x means the left side of the x-th character along the negative direction.

For example, the offset at -4 of abcdefg is the left side of character d.

When y is positive or 0, intercepting "length" y characters means obtaining y characters along the positive direction.
When y is negative, intercepting "length" y characters means discarding |y| (absolute value of y) characters along the negative direction and getting the remaining characters.

For example, The offset at -4 of abcdefg, intercepting characters with length 2, is the left side of character d, and obtaining 2 characters along the positive direction is "de"
The offset at 2 of abcdefg, intercepting characters with length -4, is the right side of character b, and discarding 4 characters along the negative direction gets the remaining character "c"
In addition:
When y is negative, %str:~y% means obtaining the last |y| characters of %str% (this can be regarded as a short form of %str:~-|y|,|y|%)
When y is positive, %str:~y% means discarding the first y characters of %str% and getting the remaining characters (this is very important, which cannot be expressed by the method of offset + length.)

About the short form:
When one of x or y is 0, 0 can be omitted. For example: %str:~0,3% can be abbreviated as %str:~,3%
When x is positive: %str:~-x,x'% can be abbreviated as %str:~-x% (here x' is any positive number greater than x)

Finally, it should be noted that an unreasonable interception will get an "empty" value.
For example, now execute
set str=abcde
set f=%str:~-2,y%
Obviously, the offset -2 of %str% is the left side of character "d". Since no matter what y is, the obtained string is a subset of the remaining string "de", so to make %f% not empty, reasonable interception is required.
When y takes 0, ±1, 2, etc., %f% is not empty; when y is less than or equal to -2, %f% is empty; when y is greater than or equal to 2, %f% is always "de".
─────────────────────────────────────────────────end
In addition:
Environment variable replacement has the following enhancements:

%PATH:str1=str2%

This will expand the PATH environment variable, replacing each "str1" in the expanded result with "str2".
To effectively remove all "str1" from the expanded result, "str2" can be empty.
"str1" can start with an asterisk; in this case, "str1" will match from the start of the expanded result to the first occurrence of the remaining part of str1.

For example, execute:
set a=123456123456
set b=123456123456
echo %a:2=+%
echo %b:1=%

It will display: 1+34561+3456
2345623456

<1>. Very important set command
set has two parameters /a and /p
Typing "set" directly will display the system environment variables and current environment variables.
Typing "set p" will display all variables starting with letter P.
No need to say more about the default parameters. Note two points:
1. Assign empty value:
set "a="
2. Develop a good habit to avoid mistakenly assigning an extra space.
For example:
set str=abc
Add a pair of double quotes:
set "str=abc"
For /a parameter
/A command line switch specifies that the string to the right of the equal sign is an evaluated numeric expression. The evaluator is simple and supports the following operations in decreasing order of priority:

() - Grouping
! ~ - - Unary operators
* / % - Arithmetic operators
+ - - Arithmetic operators
<< >> - Logical shift
& - Bitwise "AND"
^ - Bitwise "XOR"
| - Bitwise "OR"
= *= /= %= += -= - Assignment
&= ^= |= <<= >>=
, - Expression separator

Note the premise:
1. Octal number 0? (0<=?<=7) and hexadecimal number 0x? (0<=?<=15). Those not starting with 0 are decimal numbers.

2. The /a parameter only operates on integers from -(2^31-1) to 2^31 (note that it is the XP version).
This can be tested with code:

@echo off&setlocal enabledelayedexpansion
:Support the maximum number of 1.9950631168807583848837421626836e+3010
set m=1
for /l %%a in (1 1 10000) do (
for /l %%b in (1 1 %%a) do (
set /a m*=2
set /a n+=1
echo !m!=2^^^^!n!
if "!m:~,1!" == "-" echo !m!&set /a mm=!m!-1&echo !mm!=!m!-1 &pause&exit
) )

Unary operators ~ ! -
~ Take complement
Regard -(2^31-1) to 2^31 as a number axis, with "origin O" at the right side of 0 and the left side of -1.
(This number axis can be regarded as a closed number axis at both ends. Adding 1 to 2^31-1 will get -2^31)
In this way, the complement of a binary number (all integers) in the computer can be regarded as finding the "opposite number":

-2^31 ...︺︺︺︺︺︺︺︺︺︺︺︺︺︺︺O︺︺︺︺︺︺︺︺︺︺︺︺︺︺︺... 2^31-1
... -3 -2 -1 0 1 2 3 ...

~ means the opposite number of
For example:
 set /a a=~-1

%a% is equal to 0
set /a a=~5

%a% is equal to -6
! Take NOT
! is 0
! is 1
For example:
set /a a=!2

%a% is equal to 0
set /a a=!0

%a% is equal to 1
"-" Take negative number
- is consistent with -x in mathematics, but pay attention to the situation when overflow occurs.
For example:
 set /a a=-(-2147483648)

%a% is -2147483648 instead of 2147483648, because 2147483648 has overflowed:
2147483648=(2^31-1)+1
Arithmetic operators * / % ﹢ -
Arithmetic operators: * / % ﹢ - correspond to
Mathematical symbols: x ÷ mod(remainder) + -
Need to note that "%" is at the command line, while in bat, it should be written as %%

Logical shift: << >>
Note that in batch processing or command line, add a pair of double quotes "" or escape <,> with ^.
set /a "<<"
Means shift the binary number of left by bits
For example:
set /a a=15"<<"1

%a% is equal to 30
This is because: 15=bin(00 00000 00000 00000 00000 00000 01111)
Shifting left by 1 bit becomes bin(0 00000 00000 00000 00000 00000 011110)
And bin(0 00000 00000 00000 00000 00000 011110)=2^4+2^3+2^2+2^1=30

After simple mathematical derivation, it can be known that:
"<<"==*2^
">>"==/2^(note overflow)

Similarly, ">>" is right shift, the principle is the same, which is omitted here.

Logical "XOR", "OR", "AND": "^", "|", "&"
Note that in batch processing or command line, add ^ before the operator.
Here: ^ | & correspond to
In discrete mathematics: XOR⊕ Disjunction∨ Conjunction∧
Rules: Conjunction∧(if there is 0, it is 0) Disjunction∨ (if there is 1, it is 1) XOR⊕ (same is 0, different is 1)
For example:
set /a a=15^^5

%a% is equal to 10
This is because:
01111
⊕) 00101
─────
=) 01010
And bin(01010)=10

For "|", "&" the principle is the same, which is omitted here.

Assignment operator
"=" needs no explanation.
For *= /= %= += -= &= ^= |= <<= >>
Take "+=" as an example, the same for others.
This is just a shorthand.
For example, the following two lines of code are equivalent:

set /a a+=2
set /a a=a+2

Expression separator ","
This operator can be used to simplify code:
For example:

set /a a=1
set /a b=2
set /a c+=3

It can be abbreviated as:

set /a a=1,b=2,c+=3


Find the decimal part of a fraction
Example: Calculate the 100th decimal place of 7/5:
call:div 7 5 100 ans
@echo off
:div
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Setlocal Enabledelayedexpansion&set/a b=%2,R=%1%%b*10&set "dc="
For /l %%z In (1 1 %3)Do (set/a d=R/b,R=R%%b*10&set dc=!dc!!d!)
endlocal&set "%4=%dc%"
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
exit/b




In addition:
set /a ... and set /p ...
You can omit the space between set and / and write it as
set/a ... and set/p ...
There are many such usages that omit spaces, which will be supplemented later.

Pointer usage of set/a (called pointer for now):

Numerical definition:
@echo off
call:arr arr 1 2 3 4 + d d+ 258 68 944 ddd pp dd
set arr
pause
:arr
set/a n+=1
if %2.==. goto:eof
set %1%n%=%2
shift /2
goto:arr


Count the number of occurrences of various characters in a string:
@echo off
set "str=aferefwfwerergrgreaaffwafwa"
set/p= %str% 中有<nul
:loop
set /a %str:~0,1%+=1&set str=%str:~1%&if defined str goto loop
echo a %a% 个
pause


About parameter /P
set/p has two usages:

1. Receive keyboard input

@echo off
:begin
SET /p a=Please enter a string:
echo %a%
goto begin

Note that the characters that can be used as variables cannot be constant numbers, but can be letters, Chinese characters, etc., and their strings.
When entering special characters ^&|<>,add ^ in front, otherwise a syntax error occurs.
The statement "SET /p a=Please enter a string:"
Similar to c++:
cout << "Please enter a string:\n"; 
cin >> a;

2. Receive the first line of a file.
This can be understood with the following two codes. %0 means the batch processing itself:
Code 1:

:::::::::::::::::::
@echo off
set /p a=<%0
echo %a%&pause>nul

Code 2:

::::::&color 02
@echo off
set /p a=<%0
echo %a%&pause>nul

3. Special usage of set/p .
Left alignment (note that the tab in the code is):
@echo off&setlocal enabledelayedexpansion
for /l %%i in (1 10 999) do (set/a n+=1&set /p=^%%i <nul
if !n!==5 set n=0&echo.
)
pause

Delay to delete the carriage return character (can also use ping) to display:
@echo off
for /f "tokens=*" %%i in (1.txt) do echo.|set /p=%%i
pause

Delete the carriage return character of each line in 1.txt and output to 2.txt (into one line):
@echo off
for /f "tokens=*" %%i in (1.txt) do set /p=%%i<nul >>2.txt
pause

Generally, this usage of set /p will be related to | or <nul.
<nul makes the last character of the output not have a newline character, which is very useful.

[ Last edited by plp626 on 2009-4-24 at 05:00 ]
Recent Ratings for This Post ( 12 in total) Click for details
RaterScoreTime
zjwplp +1 2008-01-29 08:38
Wengier +6 2008-01-29 08:42
wujingyi +2 2008-01-29 18:16
komafd2 +1 2008-02-13 17:41
vkill +2 2008-02-25 01:48
NeverAgain +2 2008-02-27 15:23
26933062 +8 2008-03-03 01:39
523066680 +2 2008-03-15 18:12
moniuming +8 2008-11-05 22:22
wangfangjian +2 2009-03-19 09:52
regvip2008 +2 2009-05-27 09:03
516526966 +2 2010-02-11 21:00
Floor 2 Posted 2008-01-28 10:05 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
<2].for CommandDetailExplanation

start────────────────────────────────────────────────
FOR path] %variable IN (set) DO command

1. Default Parameters
for %i in (cn dos 5 2 1 ! ??.* cmd\*) do echo %i
//Print the strings in turn: cn, dos, 5, 2, 1, "The full name of non-hidden files matching ??.* in the current path", "The full name of non-hidden files in the cmd directory in the current path". The elements are delimited by spaces here.
//For the characters? * these two, for will match the file name as a wildcard, and will not display these two characters

2. Parameter d is the abbreviation of directory. The function is that when there are wildcards in the set, it matches the directory name instead of the file name.

for /d %a in (cn dos 5 2 1 ! * cmd\*) do echo %a
//Print cn, dos, 5, 2, 1, !, "The directory name of all non-hidden directories in the current path", "The directory name of all non-hidden directories in the cmd directory in the current path" in turn

3. Parameter r is the abbreviation of road. The function is that it will add the directory tree (note that the directory tree includes hidden directories and subdirectories) of the specified path to the elements in the set and then print
for /r %windir% %i in (plp626 . *) do echo %i
//Print in turn "%directory tree of %windir%\plp626" "%directory tree of %windir%\." "The full name of the corresponding file in the directory tree of %windir% (note that the files in the corresponding directory do not have the hidden attribute!)"
//When %windir% is omitted, it defaults to the current path.

4. Parameter l is the abbreviation of ladder. The function is to loop in the way of "start step end" progression. These three elements must be natural numbers. When the step is 0, it will become an infinite loop.
for /l %a in (-10 1 10) do echo %a
//Display -10 -9...10 in turn. This sentence means that the starting value is -10, increasing by 1 step, and the loop ends when it increases to 10

5. Parameter f This is very important. Look carefully. f is the abbreviation of file. Different from other parameters, this one parameter has 3 usages, each of which is very powerful:
5.1 The elements of the set are file names
for /f "eol=; skip=3 tokens=2,3* delims=, " %a in (test_1.txt test_2.txt) do echo %a %b %c
//It will analyze each line in test_1.txt test_2.txt in turn, ignore those lines starting with semicolon (eolith original, starting), skip (skip) the first 3 lines
Use "," as the delimiter (delimit), and display the 2nd, 3rd, and remaining strings (token marks).
5.2 The elements of the set are the output results of external commands
for /f "delims=" %a in ('more test.txt') do echo %a
//Cancel the default delimiter (space) to analyze the results printed by more test.txt line by line, and spaces will also become valid strings.
for /f "tokens=*" %a in ('more test.txt') do echo %a
//Analyze the results printed by more test.txt line by line. Since the default delimiter is space at this time, the space characters at the beginning of the line will not be displayed.
//Please pay attention to this pair of single quotes in the parentheses. It has the meaning of execution. The output of the execution object is used as a "file" for analysis, which determines that the output of the object must be written to memory. If it is not like this, for example, change more test.txt to start test.txt or test.txt, it will open test.txt, and %a does not receive the return character command,....
//In addition, this external command also supports compound sentences, such as:
for /f %%a in ('if exist 1.txt ^(echo ++^) else echo -- ')do echo %%a

5.3 The elements of the set are strings
for /f "tokens=*" %a in (" cn dos 帅 !") do echo %a
for /f "delims=" %a in (" cn dos 帅 !") do echo %a
//Both of these two sentences will display cn dos 帅 ! but the difference is that the former skips the space before cn, and the latter prints it as it is.
For 5.1, if there is a test 3.txt (the file name is test 3), that is, the file name contains spaces, you need to enclose it with double quotes to indicate that the file name is correctly interpreted.
But this becomes the string usage of 5.3. For the interpreter to interpret correctly, it is a file name, not a string. You need to use the keyword "usebakeq".
The following sentence displays the relevant content of the file test 3.txt (the default delimiter is space), and the interpreter will treat test 3.txt as a file name, not a string.
for /f "usebackq" %i IN ("test 3.txt") DO echo %i

Sometimes you need to judge the mobile hard disk or USB flash drive, use this command
wmic logicaldisk get name,description,drivetype


6. Expansion of for Variables
Take "test.bat" in the path C:\Documents and Settings\pp365\Desktop\ as an example, and test the for statement variables as follows
(Here, %0 is used as an example, and the corresponding variable can be substituted for 0 in the for statement):
Get the full path of this batch file with double quotes using percent 0:
"C:\Documents and Settings\pp365\Desktop\test.bat"

Use percent ~0
Print result: C:\Documents and Settings\pp365\Desktop\test.bat
Use percent ~f0
Print result: C:\Documents and Settings\pp365\Desktop\test.bat
Use percent ~d0
Print result: C:
Use percent ~p0
Print result: \Documents and Settings\pp365\Desktop\
Use percent ~n0
Print result: test
Use percent ~x0
Print result: .bat
Use percent ~s0
Print result: C:\DOCUME~1\pp365\Desktop\test.bat
Use percent ~a0
Print result: --a------
Use percent ~t0
Print result: 2008-03-05 15:51
Use percent ~z0
Print result: 947
Use percent ~$PATH:0
Print result: C:\Documents and Settings\pp365\Desktop\test.bat
---------------- Multiple results can be obtained using combined modifiers:

Use percent ~dp0
Print result: C:\Documents and Settings\pp365\Desktop\
Use percent ~nx0
Print result: test.bat
Use percent ~fs0
Print result: C:\DOCUME~1\pp365\Desktop\test.bat
Use percent ~dp$PATH:0
Print result: C:\Documents and Settings\pp365\Desktop\
Use percent ~ftza0
Print result: --a------ 2008-03-05 15:51 947 C:\Documents and Settings\pp365\Desktop\test.bat
──────────────────────────────────────────────end

[ Last edited by plp626 on 2008-3-23 at 10:53 PM ]
Recent Ratings for This Post ( 3 in total) Click for details
RaterScoreTime
NeverAgain +2 2008-02-29 17:50
wfy150 +2 2008-05-12 16:17
moniuming +8 2008-11-05 22:23
Floor 3 Posted 2008-01-28 12:49 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
<3>. Skilled in mastering CALL start
call------"Pass" in a single process
start-----Start a new process.

Using call to intercept variables:
call has a secondary preprocessing function, which originates from its function call function (personal humble opinion).
Because %v:~%x%,%y%% will preprocess %, for example, directly %v:~%x%,%y%% leaves the outermost pair of %, which makes us think of using call to further preprocess and read.

@echo off
::Cannot be displayed correctly in the command line
set a=12345678901234567890
set /p b=Enter two positive integers (not greater than 9) separated by spaces:
call echo %%a:~%b:~,1%,%b:~-1%%%
pause


call :label "parameter 1" "parameter 2" ...
From : to the first space encountered, regarded as the end of the label. (The label can be used as the %0 parameter, that is, the spaces before and after the label will be regarded as parameter separators.)
call :^^^.... will be an empty statement.
The characters after & (not ^&) in the main label are executed as statements. After execution, it jumps to the sub-label.
If one of the five characters &|><: is contained in the sub-label, the characters after it are regarded as comments and will not be explained.
The label characters cannot be a single <space> &()^=;%+,:|, but the following special characters as labels are legal:
`, ' ,^^ , ^^& , "<space>" , " , "", @,,{,},?,/,\,*,-,$,#,~,.,
When delayed environment variables are enabled,! cannot be used as a label.
Chinese characters, other extended characters, and mixed characters can also be used as labels.
Although it is not recommended to use these special characters as labels, they can implement some scripts that are difficult to implement by general methods.
There are up to 9 parameters. If there are more, you need to use the "shift" command (see later)
call follows the following rules when jumping to the label:
1, Case-insensitive,
2, Look for it after the call statement first, and look for it before if not found later.
3, Only the first label found is executed when there are multiple identical labels.
Summarize these three points into one sentence:
, case-insensitive, first later then before, execute once.

In addition
A.bat file
@echo off
call %*
goto :eof
:a
echo a task %*
goto :eof
...

If you want to execute task a, you can call it like this in B.bat file (if it is in the command line, you can omit call)
@echo off
call A.bat :a 1 2 5
pause

Here, when running B.bat under non-command line, the call in B.bat is necessary. If it is called directly in the command line as B.bat, the call in B.bat can be omitted.

Template:
@echo off & setlocal ENABLEEXTENSIONS
set x=2
set y=3
call :Area %x% %y% answer
echo/The area is: %answer%
pause
goto :EOF

:Area %width% %height% result
setlocal
set /a res=%1*%2
endlocal & set "%3=%res%"
goto :EOF


[ Last edited by plp626 on 2008-4-16 at 11:32 AM ]
Floor 4 Posted 2008-01-29 08:20 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
<4. Usage of if...else...

if condition? command A
if condition? (command A) else command B

EQU - equals
NEQ - not equals
LSS - less than
LEQ - less than or equal to
GTR - greater than
GEQ - greater than or equal to
== is different from equ. When command A is an assignment statement and the condition? is?==?, then equ should be used.
Note the variable assignment within the compound statement.

[ Last edited by plp626 on 2008-3-14 at 03:05 PM ]
Floor 5 Posted 2008-01-29 08:21 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
### <5>. Finding Commands find & findstr

#### find
Searches for a text string in a file or files.

FIND ] "string" filename]

/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF Do not skip files with offline attribute set.
"string" Specifies the text string to find.
filename
Specifies a file or files to search.

If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.

If no path is specified, FIND searches the text typed or piped from another command.
When using find "?" file, the result will always have a line at the beginning like (indicating that the following content is from *.* this file)
---------- *.*
When the /v and /c parameters are used together, it is (n is an integer)
---------- *.*: n
Now, let's talk about the usage of parameters:
/v parameter: lines not containing "str" As the help says, it displays lines that do not contain the specified string.
find /v "?" ... displays lines that do not contain "?".
But commonly used is find /v "" ...
It prints all the content of the file because the file does not contain empty characters.
/c parameter: count the number of lines It does not display the content, only displays the number of lines containing the search string.
Here, it is necessary to understand that when find analyzes a file, it takes the carriage return and line feed characters as markers to determine the end of one line and the start of the next line.
find /c "?"... does not display lines containing "?", but displays the number of lines containing "?".
find /c /v "?" ... does not display the content of the lines, but displays the number of lines that do not contain "?".
find /c /v "" ... only displays the number of lines that do not contain empty characters, that is, the total number of lines in the file.
/n parameter: number of lines If it displays the content of the lines, it adds the line number at the beginning of the line.
The /n is always effective only when used together with /v, and is invalid when used together with the /c parameter.
/i parameter: Ignores case for "?"
If "string" contains spaces, the spaces will not be interpreted as logical OR, but as a valid string.
find parameter "?" *.txt *.c searches in all txt files in the current path according to (files can also be in enumerated format: 1.txt 2.txt 3.txt)
Common formats:
find /c "?" *.txt *.bat
find /v "?" *.txt *.bat
find /n "?" 1.txt
find /c /v "" *.*

#### findstr
FINDSTR
]
strings filename]

/B Matches pattern if at the beginning of a line.
/E Matches pattern if at the end of a line.
/L Uses search strings literally.
/R Uses search strings as regular expressions.
/S Searches for matching files in the current directory and all
subdirectories.
/I Specifies that the search is not to be case-sensitive.
/X Prints lines that match exactly.
/V Prints only lines that do not contain a match.
/N Prints the line number before each line that matches.
/M Prints only the filename if a file contains a match.
/O Prints character offset before each matching line.
/P Skip files with non-printable characters.
/OFF Do not skip files with offline attribute set.
/A:attr Specifies color attribute with two hex digits. See "color /?"
/F:file Reads file list from the specified file(/ stands for console).
/C:string Uses specified string as a literal search string.
/G:file Gets search strings from the specified file(/ stands for console).
/D:dir Search a semicolon delimited list of directories
strings Text to be searched for.
filename
Specifies a file or files to search.

Use spaces to separate multiple search strings unless the argument is prefixed
with /C. For example, 'FINDSTR "hello there" x.y' searches for "hello" or
"there" in file x.y. 'FINDSTR /C:"hello there" x.y' searches for
"hello there" in file x.y.

Regular expression quick reference:
. Wildcard: any character
* Repeat: zero or more occurances of previous character or class
^ Line position: beginning of line
$ Line position: end of line
Character class: any one character in set
Inverse class: any one character not in set
Range: any characters within the specified range
\x Escape: literal use of metacharacter x
\<xyz Word position: beginning of word
xyz\> Word position: end of word

For full information on FINDSTR regular expressions refer to the online Command
Reference.

The maximum number of bytes for the search string is 127.
Examples of general expressions:
1.
findstr . 2.txt or findstr "." 2.txt
Find any characters (including spaces) from file 2.txt, excluding empty characters or empty lines (filters empty lines). This usage is also valid for Unicode characters, the same below.

2.
findstr .* 2.txt or findstr ".*" 2.txt
Find any characters including empty lines from file 2.txt (prints as is).

3.
findstr "" 2.txt
Find strings or lines including numbers 0-9 from file 2.txt.

4.
findstr "" 2.txt
Find strings or lines including any of the 52 English letters from file 2.txt.

5.
findstr "" 2.txt
Find strings or lines including letters a, b, c, e, z, y from file 2.txt.

6.
findstr "" 2.txt
Find strings including lowercase characters a-f and l-z from file 2.txt, but not including letters g, h, I, j, k.

7.
findstr "MY" 2.txt
Can match MahY, MbiY, MahY, etc. in file 2.txt.

8.
Application of ^ and $ symbols
^ means the beginning of a line, "^step" only matches the first word in "step hello world".
$ means the end of a line, "step$" only matches the last word in "hello world step".

9.
finstr "" 2.txt
Any character not in the character set 0-9, that is, if there is a character not belonging to 0-9, it is printed.
For example, dfd41210's other 45, etc. will be printed; while 54545158 will not be printed.

10.
findstr "" 2.txt
Any character not in the character set a-z, that is, if there is a character not belonging to a-z, it is printed.
For example, adfdfd2225 dfdfdfdfd 大富大贵, etc. will be printed; while dfdfdffd will not be printed.

11.
The role of the * sign
As mentioned earlier, ".*" means the search condition is any character. The * sign in the regular expression does not mean any character, but means the number of repetitions of the previous character or expression. The * sign means zero or more repetitions.

12.
findstr "^*$" 2.txt
This matches pure numbers. ^ represents the beginning, represents numbers, * represents zero or more repetitions, and $ represents the end.
For example, 234234234234. If it is 2133234kkjl234, it will be filtered out. But a single number does not match.
Findstr "^*$" 2.txt
This matches pure letters. For example, sdfsdfsdfsdf. If it is 213sldjfkljsdlk, it will be filtered out.
If there is no * sign in the search condition, that is, the search condition is not repeated, that is, , it can only match the first character of the string, and only this one character. Because of the restrictions of the beginning and end of the line, "^$" will match if the first character is a number, and filter out if it is not. If the string is 9, it matches; if it is 98 or 9j, etc., it does not.

13.
The role of the "\<…\>" expression
This means to accurately find a string. \<sss means the start position of the word, and sss\> means the end position of the word.
echo hello world computer|findstr "\<computer\>" in this form.
echo hello worldcomputer|findstr "\<computer\>" in this form does not work. It is looking for the "computer" string, so it is not possible.
echo hello worldcomputer|findstr ".*computer\>" can match in this way.

14. "." means any character.
findstr /rc:" 01...... " test.txt>>a1.txt
findstr /rc:" 02...... " test.txt>>a2.txt

15.
Find the period "." in English state.
Add the escape character "\" in front of ".".

set abc=abc de.f
echo %abc%|findstr /c:"\."

16. Find "\"

set abc=abc E:\123 1111
echo %abc%|findstr "E:\\"

17. /g usage
Take each line of 1.txt as the search string and search in 2.txt. (If a line in 1.txt contains spaces, it is also regarded as a valid character and not interpreted as "or".)
findstr /g:1.txt 2.txt

Adding /b/e means exact match at the beginning and end of the line.
findstr /b /e /g:1.t 2.t (or findstr /beg:1.t 2.t)

18. /o parameter
((echo.%str%&echo. )|findstr /o .)|findstr /c:" "

Example:
findstr . test.txt
Filter empty lines and print.
findstr .* test.txt
Print as is. This is different from find /v "", the latter will add ---------- target file full name at the beginning of the result.
findstr . test.txt|findstr /v /r /c:"^ * $"
Filter empty lines and pure space lines and print.
-------------
There is a file A.TXT. When JKLJHLL is found in it, delete the lines containing the JKLJHLL string (case-insensitive).
findstr /ivc:"JKLJHLL" a.txt >b.txt

[ Last edited by plp626 on 2008-4-27 at 01:55 AM ]
Floor 6 Posted 2008-01-29 08:21 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
<6>.Check commands echo type more sort

[ Last edited by plp626 on 2008-3-3 at 11:15 PM ]
Floor 7 Posted 2008-01-29 08:22 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
### <7>. Access Commands dir cd
First, talk about dir (directory)
Displays a list of files and subdirectories in a directory.

DIR attributes]]
sortorder]] timefield]]


Specifies drive, directory, and/or files to list.

/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/B Uses bare format (no heading information or summary).
/C Display the thousand separator in file sizes. This is the
default. Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/S Displays files in specified directory and all subdirectories.
/T Controls which time field displayed or used for sorting
timefield C Creation
A Last Access
W Last Written
/W Uses wide list format.
/X This displays the short names generated for non-8dot3 file
names. The format is that of /N with the short name inserted
before the long name. If no short name is present, blanks are
displayed in its place.
/4 Displays four-digit years

Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W. Among them, /a, /o, /t each have their own parameters (only one can be selected).
/a attribute (attribute)
There are 5 parameters: d (directories), r (read-only), h (hidden), a (archiving), s (system) and the negation switch "-"
/o order (order)
There are 5 parameters: n (name), s (size), e (extension), d (date), g (group directories) and a "reverse order" switch "-"
/o:n
Name priority (higher first) is generally: space!()-,._`+12...9aAbB...zZ Chinese characters are converted to pinyin initials ab...z
/os
File bytes: smaller first
/oe
Extension priority: empty (no extension) characters numbers letters Chinese characters in that order
/od
Earlier time first
/og
Priority to be determined
/tc
Creation date
/ta
Last access date
/tw
Last written date

/t time (time)
There are 3 parameters: c (creation) a (last access) w (written)
In addition:
dir |dir .|dir .\ /* Current path, files, directories
dir ..|dir ..\ /* Previous path down,...
dir \ /* Under the root directory...

-----------------------------------------------------
cd .. Enter the parent directory
cd\ Enter the root directory
cd Display the current directory

[ Last edited by plp626 on 2008-3-3 at 06:09 PM ]
Floor 8 Posted 2008-01-29 08:22 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
<8>.comp and fc
....Please look forward to it...
Floor 9 Posted 2008-01-29 08:23 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
<9>,File Operations Commands copy xcopy md move del rd attrib ren replace

....Stay tuned...

[ Last edited by plp626 on 2008-1-29 at 09:55 AM ]
Floor 10 Posted 2008-01-29 08:23 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
<10>.cmd and command

....Stay tuned....

[ Last edited by plp626 on 2008-1-29 at 09:58 AM ]
Floor 11 Posted 2008-01-29 08:23 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
<11>,Explanation of CACLS and AT Scheduled Tasks

....Stay tuned...

[ Last edited by plp626 on 2008-1-29 at 09:59 AM ]
Floor 12 Posted 2008-01-29 08:24 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
<13>. Special characters <> / \ %! & ^ | and *.?,;

....Stay tuned...

[ Last edited by plp626 on 2008-2-10 at 01:37 AM ]
Floor 13 Posted 2008-01-29 08:24 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
### <14>.prompt 与 debug)

Full screen (XP):
```
@echo off
echo exit|cmd /kprompt e100 B8 12 00 CD 10 B0 03 CD 10 CD 20 $_g$_q$_|debug>nul
@pause
```

[ Last edited by plp626 on 2008-3-20 at 01:49 PM ]
Floor 14 Posted 2008-01-29 08:24 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
<15>.Other built-in commands</color>
....Please look forward to it...
Floor 15 Posted 2008-01-29 08:25 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
Calculate the difference between two time points
@echo off
if %1.==/??. more %~fs0&exit/b

:Algorithm: abcdefdh-640000ab-4000cd=abcdefdh-4000*(60ab+abcd)
:No need to specify the order of the times, the function will automatically correct it
@echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:_timediff Returns the minimum parameter: 0.01 seconds
Setlocal Enabledelayedexpansion&set a=%1&set b=%2
set sc=%b::=%-%a::=%&set ad=%b:~,-6%-%a:~,-6%
set/a ab=%b:~,-9%-%a:~,-9%,ad=%ad::=%,sc=%sc:.=%
set/a c=sc-4000*(60*ab+ad)&set c=!c:-=!&if !c! leq 9 set c= 0!c!
endlocal&if %3.==. (echo %c:~,-2%.%c:~-2% S) else set %3=%c: 0=%
exit/b
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Colorful character output function
@echo off
if %1.==/?. goto:help
if %1.==/??. more %~fs0&exit/b

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:_colstr
setlocal&pushd %tmp%&for /f "tokens=1* delims=:" %%a in ("%~1")do (
if "%%~b".==%%b. (if exist "%%~b?" del/a/q "%%~b?"2>&1
set/p= <nul>"%%~b"2>nul&findstr /a:%%a .* "%%~b?"2>nul 3>&2
) else (if %1==\n (echo\) else (if %1==\b (set/p=<nul) else (
set/p"=%~1"<nul))))&if %2. neq . (shift&endlocal&goto:_colstr)
exit/b
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:help
echo ------- print color strings ---------
echo colstr V2.0 plp626@cn-dos.net&echo.
echo %~n0 ;...; ...;;... &echo.
echo Description:
echo 1. The string cannot contain illegal characters of file names. If the string contains one of the four characters ^^=,;, then you need to add ^^ in front of them (otherwise, cmd will replace them with empty characters or spaces). If the string contains. or space, . and space cannot be the last character of the string.
echo 2. The common-str cannot contain double quotes.
echo If it is a normal character (number, letter, Chinese character, etc.), the pair of double quotes outside the common-str can be omitted.
echo 3. The parameter \n means carriage return and line feed, and \b means backspace.
echo 4. Attr is a 4-digit hexadecimal number used to control the color attributes. If attr is less than 4 digits, the high bit defaults to 0. For example: 000a is the same color as a, 0a, 00a.
echo When attr is two digits, the first is the background and the second is the foreground. Each number is one of the following values:
cmd/c %~n0 \n; " "
(for %%b in (0 1 2 3 4 5 6 7 8 9 A B C D E F)do cmd/c %~n0 " ";%%b:"%%b")&echo\&echo\
echo When attr is a 3-4 digit number, the role of the last two digits remains the same, and the high two digits output the corresponding border line:
echo\&for %%b in (0 1 2 3 : 4 5 6 7 : 8 9 A B : C D E F)do (
if %%b==: (echo\&echo\) else cmd/c %~n0 " 0%%b00 = "; 0%%b00:"%%b";
)
cmd/c %~n0 \n;\n; a:"〖";c:"Notice"; a:"〗"; "Each parameter of the function, it is recommended to use"; c:"^;";" to separate.");\n
echo The following example is very useful:
echo %~n0 a:"A";b0:" B";" ";0c0e:"C";\n;"~!%%^&*()+|`=\{}:;'<>?,.";d:"plp626"
echo The display is as follows:
cmd /c %~n0 a:"A";b0:" B";" ";0c0e:"!!";\n;"~!@%%^&*()+|`=\{}:;'<>?,.";d:"plp626"
exit/b




One - sentence hiding:
code 1:
@if %1* neq 0* mshta vbscript:createobject("wscript.shell").run("%~s0 0",0)(window.close)&exit
code 2:
@if %1* neq 0* (goto c) else mshta vbscript:createobject("wscript.shell").run("%~s0 0",0)(window.close)&exit
code 3:(This is the shortest, hehe, my code)
@if exist .vbs (del .vbs) else echo createobject("wscript.shell").run "%~s0",0 >.vbs&.vbs&exit

Hidden call:
@echo off
if not %1.==. call%*
pause
goto:hid
:code
set set1=ping -n 2 127.1 1^>nul 2^>nul
for /l %%i in (1 1 5) do md test-%%i&%set1%
for /l %%i in (5 -1 1) do rd test-%%i&%set1%
msg %username% /v /w "~~~~~Test completed, click OK to exit cmd~~~~"
exit
rem --------subprocess----------
:hid
if not %1.==. (goto:code) else mshta vbscript:createobject("wscript.shell").run("%~s0 :hid 0",0)(window.close)


----------------------------------------------------------
I don't know how much enthusiasm there is left, it's almost there... Hehe
After half a year, I have learned some things. While there is still enthusiasm now, I share these good methods I think with everyone, which is a return to everyone. Unfortunately, I still only know bat from start to finish.

Some usages of call
@echo off
::This is for one-dimensional arrays, everyone can expand it to two-dimensional, the definition.
call:arr arr + d d+ 258 68 944 ddd pp dd plp df
for /l %%a in (0 1 10) do set arr%%a
pause
:arr
set/a n+=1
if %2.==. goto:eof
set %1%n%=%2
shift /2
goto:arr


@echo off
::Assign the input string as a variable. This is very useful
set/p var=
call:x %var% plp626
for /f %%a in ("%var%")do call echo %%%%a%%
pause

:x
set %1=%2

In the collection of for, compound statements are also supported:
  for /f %%a in ('if exist 1.txt ^(echo ++^) else echo -- ')do echo %%a
You might as well replace if with for and find out.
Recursive usage of call
@echo off
call:gcd 258 24 ans
echo %ans%
exit/b
:: Euclidean algorithm to find the greatest common divisor (GCD) of two integers
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:gcd //
if %2 neq 0 set/a p=%1%%%2
if %2==0 (set %3=%1&exit/b) else (call:gcd %2 %p% %3&exit/b)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Usage of start
@echo off&if not %1.==. goto%*&exit/b
::Analyze the sub - process as the collection object of for. (This can also be recursive, ) can minimize the generation of temporary files to the maximum extent

for /f "delims=" %%a in ('%~s0 :a 1 2 3')do echo %%a
pause
for /f "delims=" %%a in ('%~s0 :b')do echo %%a
pause
::Multi - process
start/b %~s0 :a + - * /
pause&exit

:a
echo %*
exit/b
:b
echo ---b
exit/b


The first line of this statement "if not %1.==. call%*&exit" I often use it in many codes, and the position has been solidified. It makes the code much more readable and also much simpler.

I know a little about vbs. The following code contains the idea of mixed programming, and the batch processing skills should not be underestimated:
@echo off&if not %1.==. call%*&exit
::Hide "call" For the original post, please search for "borrowing the corpse to return the soul" (please don't do bad things with this)
pause
goto:hid
:code
set set1=ping -n 2 127.1 1^>nul 2^>nul
for /l %%i in (1 1 5) do md test-%%i&%set1%
for /l %%i in (5 -1 1) do rd test-%%i&%set1%
msg %username% /v /w "~~~~~Test completed, click OK to exit cmd~~~~"
exit
:: /*-------- hideme ----------
:hid
if not %1.==. (goto:code) else mshta vbscript:createobject("wscript.shell").run("%~s0 :hid 0",0)(window.close)&exit
:: -------- hideme ----------*/


Multi - process: (I don't know what these two codes can explain)
@echo off&if not %1.==. call%*&exit||by plp626@cn-dos.net
for /l %%a in (0 1 9) do start/b %~s0 :%%a
exit
:0
:1
:2
:3
:4
:5
:6
:7
:8
:9
echo Process %0 starts at %time%
title Right - click to pause, left - click to continue, pay attention to the time sequence
for /l %%a in (1 1 1000)do echo I am process %0 Current time: %time%
goto:eof

@echo off&if not %1.==. call%*&exit||by plp626@cn-dos.net
for /l %%a in (0 1 9) do start/b %~s0 :%%a
exit
:0
:1
:2
:3
:4
:5
:6
:7
:8
:9
echo Process %0 starts at %time%
title Right - click to pause, left - click to continue, pay attention to the time sequence
for /l %%a in (1 1 1000)do echo I am process %0 Current time: %time%>%tmp%\txt
goto:eof


If your computer is a 10-core one:
@echo off
::Six are pure numbers, need the external tool unrar.exe
set file=6-bit crack
if not "%1"=="" call%*&exit
for /l %%a in (0 1 9) do start/b %~s0 :%%a
exit
:0
:1
:2
:3
:4
:5
:6
:7
:8
:9
echo Process %0 starts at: %time%
for /l %%a in (0 1 9)do if "%0"==":%%a" set p=%%a
for /l %%a in (0 1 9)do for /l %%b in (0 1 9)do for /l %%c in (0 1 9)do for /l %%d in (0 1 9)do for /l %%e in (0 1

9)do call:key %%a %%b %%c %%d %%e %0
echo Process %0 ends at: %time%
goto:eof

:key
title Process %6 is testing: %p%%1%2%3%4%5 Current time: %time%
unrar t -p%p%%1%2%3%4%5 "%file%.rar">nul 2>nul &&(
echo %p%%1%2%3%4%5 >key.txt
msg %username% /v "The password is %p%%1%2%3%4%5"
tskill /a cmd

)
goto:eof

Communication between multi-processes
Now the method of using temporary files is still reliable. I haven't tried the method of modifying the system environment variables such as date.
In addition, the method of using exit/b?(? is a number from 0 to 9) and then using errorlevel to determine which sub-process exits can play this role in simple cases.

A process "pause" (actually it is still in the execution state, just the execution pause command pauses), another process is in the execution state. If when this process also pauses, no matter how high the priority of this process is, the key corresponds to the first process that executes pause.

@echo off&if not "%1"=="" call%*&exit
::Pure batch to achieve waiting for specified input
:begin
call:timeout 5 :tsk1 626 :tsk2
:tsk1
echo\&echo "Default plan"
echo\&echo Press Enter to exit
exit

:tsk2
echo "Custom plan"
pause
exit
:: /*----------------- timeout --------------------
:timeout
setlocal&del/a/q %tmp%\' 2>nul||(echo Unknown error!&pause&exit)
start/b/REALTIME %~s0 :timeout_1 %1 %2 %3 %4
:timeout_2
set "v="
set/p v=
if %v%.==%3. title %ComSpec%&cd.>%tmp%\'&endlocal&goto%4
if exist %tmp%\' exit ::No input, exit timeout
goto:timeout_2
:timeout_1
for /l %%a in (%1 -1 0)do (
title Countdown:%%a /Input:%3 Skip default plan %2/
if exist %tmp%\' title %ComSpec%&exit
ping/n 2 127.1 >nul)
title %ComSpec%&cd.>%tmp%\'&goto%2
:: --------------------- timeout -------------------*/



There are many usages of call, mainly about parameters. You need to master setlocal well. Everyone pays more attention to the following two posts in their spare time.

http://www.cn-dos.net/forum/viewthread.php?tid=38969&fpage=1
http://www.cn-dos.net/forum/viewthread.php?tid=39777&fpage=2
Share more with others and benefit a lot

[ Last edited by plp626 on 2009-4-24 at 05:06 ]
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
NeverAgain +2 2008-02-29 17:51
moniuming +8 2008-11-05 21:28
Forum Jump: