How to achieve cyclic effect in batch processing
This article mainly introduces how to achieve the cycle effect of batch processing, the article introduces in great detail, has a certain reference value, interested friends must read it!
Run the executive command worker A for the first time
Run the execution command worker B for the second time
Run the execution order worker A for the third time
.
The principle is simple.
Judge by if exist
The specified file does not exist the first time it runs
Then run command A
And create the specified file
The second run time specifies that the file exists
Then run command B
And delete the specified file
The specified file does not exist in the third run
.
Two examples are written so that you can have a try.
1. Show / hide the file extension (effective after running and refreshing)
@ echo off
If not exist c:windows\ wind.txt (
Break > c:windows\ wind.txt
Reg add hkcu\ software\ microsoft\ windows\ currentversion\ explorer\ advanced / v hidefileext / t reg_dword / d 0 / f
) else (
Reg add hkcu\ software\ microsoft\ windows\ currentversion\ explorer\ advanced / v hidefileext / t reg_dword / d 1 / f
Del c:windows\ wind.txt
)
2. Enable / disconnect broadband connection
@ echo off
If not exist c:windows\ wind.txt (
Break > c:windows\ wind.txt
Rasphone / d broadband connection
) else (
Rasphone / h broadband connection
Del c:windows\ wind.txt
)
The above is all the content of the article "how to achieve cyclic effect in batch processing". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!