中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-19 10:09
47,814 topics / 349,908 posts / today 0 new / 48,259 members
DOS疑难解答 & 问题讨论 (解答室) » How to read a property file or options file under DOS?
Printable Version  935 / 4
Floor1 cao7113 Posted 2008-05-23 10:11
初级用户 Posts 19 Credits 50
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!
Floor2 cao7113 Posted 2008-05-23 12:56
初级用户 Posts 19 Credits 50
Let me bump this first!

This function is very common in many situations, and I hope everyone can give some good solutions!
Floor3 netwinxp Posted 2008-05-24 15:44
高级用户 Posts 366 Credits 741
You can use INT 21H function 43H to get/set file attributes, and 57H to get/set file time attributes.
Floor4 cao7113 Posted 2008-05-27 19:03
初级用户 Posts 19 Credits 50
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
Floor5 caojianli Posted 2008-05-27 23:58
初级用户 Posts 17 Credits 38
Can you give an example of using 57H to get/set file time attributes?
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023