Intercept string:
Set var=10203040
The first digit is the position, the second position is the length, the second position if none, the default is the end, and the first position if it is a negative number, then the position in the opposite direction. Position starting from 0
Copy Code code as follows:
Echo%var:~-4,3%
Echo%var:~0%
Echo%var:~1%
Echo%var:~-2%
Replace string
Copy Code code as follows:
echo%var:0=kkk% 0 replaced by KKK
Echo%var:10=kkk% 10 replaced by KKK
Echo%var:20=kkk%
Echo%var:*20=kkk% 20 includes 20 strings replaced by KKK
In this way, you can execute multiple commands at the same time, regardless of whether the command was executed successfully
Dir c:\*.exe & dir d:\*.exe & dir e:\*.exe
&& Usage: First command && second command [&& Third Order ...]
The following command is not executed when a command is encountered that executes the error, and all commands are executed if there is no error;
|| Usage: first Command | | The second command [| | | The Third order ...]
The following command is not executed when the correct command is encountered, and all commands are executed if the correct command is not present;