The Wonderful Use of DOS Batch Files
There are two types of operating systems in most computer users' machines: Windows and DOS.
The dark interface of DOS and the command-line input method cannot be compared with Windows. But now there are many applications still designed based on DOS, which can perform best under DOS, so we still need DOS.
DOS is not very easy to use, but we have to use it. The only way to solve this problem is to enhance its functions! The DOS batch file is one of them.
A batch file is like a macro. It is a text file that contains some standard DOS commands and also some special control commands for batch processing. The extension of a batch file is.bat. The DOS command processor (command.com) specifies that a batch file is an executable file. As long as you type the.bat file name in the command line, DOS will execute the statements in the.bat one by one. The function is equivalent to entering each command in the command line. Through different combinations of batch processing statements, there will be very unexpected effects. I will use some examples to illustrate to you below.
1. When we set the path, if there was an original path, it will be overwritten by the new one. If we don't want to overwrite, we must type both the new path and the old path in the command line, which is very tiring! Look at the following program:
@echo off
if "%1" == "" GOTO END
set path=%path%
path %1;%path%
:END
Explanation:
%1: The first parameter, the content is the path to be added. If there is no content, it ends.
2. Some software, when in use, either has a path pointing to it or runs in the current directory. Because such software only looks for auxiliary files such as data in the current and specified paths, so if there is no path pointing and not in the current path, the program will say "File not found". Then, can we add all paths to the environment variable PATH? Theoretically, it is possible, but DOS has a limit that the total number of characters in the command line cannot exceed 127. And PATH is to be executed by the command line, and the result is predictable. If it exceeds, DOS will unhesitatingly tell you: Environment variable overflow!
If you want to return to the original path after executing the above kind of program, look at the following program:
@echo off
set tmppath=%path%
set path=%1
%2
path=%tmppath%
set tmppath=
Explanation:
%1: The first parameter. It is the path of the software to be run, and it must be written completely.
%2: The second parameter. The file name for software operation.
3. What to do if the program exits abnormally or the Chinese system has a screen garble? It can also be solved with batch processing.
This batch processing program uses several commands provided by DOS.
@echo off
PROMPT $P$G
MODE CO80
KEYB US,437
ECHO
There are two types of operating systems in most computer users' machines: Windows and DOS.
The dark interface of DOS and the command-line input method cannot be compared with Windows. But now there are many applications still designed based on DOS, which can perform best under DOS, so we still need DOS.
DOS is not very easy to use, but we have to use it. The only way to solve this problem is to enhance its functions! The DOS batch file is one of them.
A batch file is like a macro. It is a text file that contains some standard DOS commands and also some special control commands for batch processing. The extension of a batch file is.bat. The DOS command processor (command.com) specifies that a batch file is an executable file. As long as you type the.bat file name in the command line, DOS will execute the statements in the.bat one by one. The function is equivalent to entering each command in the command line. Through different combinations of batch processing statements, there will be very unexpected effects. I will use some examples to illustrate to you below.
1. When we set the path, if there was an original path, it will be overwritten by the new one. If we don't want to overwrite, we must type both the new path and the old path in the command line, which is very tiring! Look at the following program:
@echo off
if "%1" == "" GOTO END
set path=%path%
path %1;%path%
:END
Explanation:
%1: The first parameter, the content is the path to be added. If there is no content, it ends.
2. Some software, when in use, either has a path pointing to it or runs in the current directory. Because such software only looks for auxiliary files such as data in the current and specified paths, so if there is no path pointing and not in the current path, the program will say "File not found". Then, can we add all paths to the environment variable PATH? Theoretically, it is possible, but DOS has a limit that the total number of characters in the command line cannot exceed 127. And PATH is to be executed by the command line, and the result is predictable. If it exceeds, DOS will unhesitatingly tell you: Environment variable overflow!
If you want to return to the original path after executing the above kind of program, look at the following program:
@echo off
set tmppath=%path%
set path=%1
%2
path=%tmppath%
set tmppath=
Explanation:
%1: The first parameter. It is the path of the software to be run, and it must be written completely.
%2: The second parameter. The file name for software operation.
3. What to do if the program exits abnormally or the Chinese system has a screen garble? It can also be solved with batch processing.
This batch processing program uses several commands provided by DOS.
@echo off
PROMPT $P$G
MODE CO80
KEYB US,437
ECHO
我的网志
http://hzmys.blog.163.com/
我的网盘
firststep.qjwm.com
fsmys.ys168.com
ssmys.ys168.com
www.brsbox.com/fsmys
www.brsbox.com/ssmys
www.brsbox.com/ccdos
http://hzmys.blog.163.com/
我的网盘
firststep.qjwm.com
fsmys.ys168.com
ssmys.ys168.com
www.brsbox.com/fsmys
www.brsbox.com/ssmys
www.brsbox.com/ccdos









