Whether DOS batch processing can be performedProgramRead the configuration file, similar to the INI file?
I have found a feasible solution. Examples of programs and configuration files are as follows.
The purpose of this article is to record and prepare materials for future reference.
Configuration file:
# Configuration file, parsing configuration variables # One Line for each configuration file setting value # You can add a comment line with "#" # "for behavior # You can add a" # "comment # the path of the file can be an absolute path, it can also be a relative path. In Windows, the file path must use "/" instead of "\" to indicate the connector connection string osqlcnstr =-s127.0.0.1, 21433-e-H-1-n-B-M15-W 500366bcp.exe connection string bcpcnstr =-s127.0.0.1, 21433-T-cdbserver = (local) database = testdbuid = testuserpwd = testpwdinputdatadir =. \ datainputdatafile = contactinfo.txt dtslogfile = cvt_usrinfo.log ################################# ######################
Batch Processing Program:
@ echo offset DEBUG = 0rem the configuration file uses" # "as the line. the row-end annotator REM configuration item cannot contain spaces or double quotation marks. Rem configuration values cannot contain double quotation marks. Rem removes empty rows and comment rows.. Note that the rows with spaces cannot be removed. Take % B and discard the % becho. Echo environment variable configuration as follows: For/F "EOL = # tokens = *" % A in (% ~ N0.txt) Do (REM echo. If % debug % = 1 echo debug 1: A = % A. B = % B. Rem remove the end comments of the line. Take % m and discard % Nfor/F "delims = # tokens = 1 *" % m in ("% ") do (if % debug % = 1 echo debug 2: M = % m. N = % N. rem resolution configuration to Remove empty lines. Take % x, % Y, discard % zfor/F "delims = tokens = 1, 2 *" % x in ("% m ") do (if % debug % = 1 echo debug 3: x = % x. y = % Y. if not "% Y" = "" (REM removes the white space character of the configuration item. For/F % K in ("% x") Do (REM removes the blank characters of the Configuration value. For/F "tokens = 1 *" % v in ("% Y") Do (if "% W" = "" (echo. % K. =. % v. set % K = % v) else (echo. % K. =. % v % W. set % K = % v % W) echo read configuration is complete. echo.