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-07-02 11:36
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » How to read a property file or options file under DOS? View 875 Replies 4
Original Poster Posted 2008-05-23 10:11 ·  中国 北京 光环新网
初级用户
Credits 50
Posts 19
Joined 2008-03-31 15:10
18-year member
UID 114544
Gender Male
Status Offline
Hello everyone:
How can the function of reading a property file or options file be implemented under DOS?

There are generally the following 3 ways to read options in DOS:
1. Set environment variables in advance, and reference the environment variables in commands
2. Use the built-in command-line parameter reading function of certain commands themselves
3. Read a specified config file / options file / property file, and extract variable values from it

The first two cases are relatively easy to handle, but how can case 3 be implemented?

I'm asking the experts, seniors, and friends in the DOS world for advice. Please share your opinions! Thanks!
Floor 2 Posted 2008-05-23 12:56 ·  中国 北京 光环新网
初级用户
Credits 50
Posts 19
Joined 2008-03-31 15:10
18-year member
UID 114544
Gender Male
Status Offline
Let me bump this first!

This function is very common in many situations, and I hope everyone can give some good solutions!
Floor 3 Posted 2008-05-24 15:44 ·  中国 福建 厦门 电信
高级用户
★★★
Credits 741
Posts 366
Joined 2007-07-25 19:11
18-year member
UID 94024
Gender Male
Status Offline
You can use INT 21H function 43H to get/set file attributes, and 57H to get/set file time attributes.
Floor 4 Posted 2008-05-27 19:03 ·  中国 北京 光环新网
初级用户
Credits 50
Posts 19
Joined 2008-03-31 15:10
18-year member
UID 114544
Gender Male
Status Offline
The contents of the BAT version of propImport.bat that I implemented are as follows:

@echo off&goto Start

20080525 cao
a prop reader implemented by bat file
commentChar is #
prop definition like propName=propValue

:Usage
echo Usage: %~n0 propFullPathName
goto End

:Start
set commentCahr=#
set delimChar==
if not "%~1"=="" (set propFile=%~1) else goto Usage

for /f "eol=%commentChar% tokens=1,* delims=%delimChar%" %%i in (%propFile%) do @set %%i=%%j

:End
Floor 5 Posted 2008-05-27 23:58 ·  中国 河北 衡水 联通
初级用户
Credits 38
Posts 17
Joined 2008-05-03 00:14
18-year member
UID 117607
Gender Male
Status Offline
Can you give an example of using 57H to get/set file time attributes?
Forum Jump: