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-05 20:33
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Share] Batch Processing to Read INI File View 13,213 Replies 44
Floor 16 Posted 2007-03-19 11:08 ·  中国 山西 运城 电信
新手上路
Credits 5
Posts 3
Joined 2006-01-16 22:06
20-year member
UID 49090
Status Offline
Floor 17 Posted 2007-03-19 14:30 ·  中国 福建 泉州 电信
银牌会员
★★★
Credits 1,276
Posts 469
Joined 2002-12-23 13:00
23-year member
UID 586
Gender Male
From 福建泉州
Status Offline
Originally posted by yangzhiyi at 2007-3-17 07:52 AM:
There is still one parameter missing. There should be a function to read the value of the project, such as
timeout=3
Get 3

Now
inifile c:\boot.ini "" timeout
:: display ...


You can read this yourself with a batch script.
You can also modify the batch script yourself to set timeout as an environment variable, which is the value of timeout, 3
QQ:366840202
http://chenall.net
Floor 18 Posted 2007-03-22 19:44 ·  中国 重庆 沙坪坝区 电信
初级用户
Credits 20
Posts 17
Joined 2007-03-15 23:04
19-year member
UID 81862
Gender Male
Status Offline
Floor 19 Posted 2007-03-23 05:58 ·  中国 贵州 六盘水 移动
初级用户
Credits 24
Posts 13
Joined 2007-03-23 04:55
19-year member
UID 82620
Gender Male
Status Offline
The syntax of the prompt command is incorrect
Floor 20 Posted 2007-04-17 01:54 ·  中国 广东 广州 番禺区 电信
初级用户
Credits 98
Posts 47
Joined 2007-01-28 05:39
19-year member
UID 77912
Gender Male
Status Offline
Good stuff
Floor 21 Posted 2007-04-25 07:36 ·  中国 北京 联通
新手上路
Credits 13
Posts 6
Joined 2007-04-25 02:28
19-year member
UID 86353
Gender Male
Status Offline
Thanks for sharing
Floor 22 Posted 2007-04-26 11:56 ·  中国 福建 泉州 电信
银牌会员
★★★
Credits 1,276
Posts 469
Joined 2002-12-23 13:00
23-year member
UID 586
Gender Male
From 福建泉州
Status Offline
07-04-25
Added a function to set variables. Please refer to the comments inside for details.

Friends who need this function can test it.
QQ:366840202
http://chenall.net
Floor 23 Posted 2007-06-01 16:21 ·  中国 北京 联通
初级用户
Credits 20
Posts 12
Joined 2007-06-01 12:47
19-year member
UID 89957
Gender Male
Status Offline
Floor 24 Posted 2007-06-25 15:38 ·  中国 上海 闵行区 电信
新手上路
Credits 2
Posts 1
Joined 2007-06-25 15:10
19-year member
UID 92309
Gender Male
Status Offline
Can the thread starter add some comments? I don't quite understand it.
Floor 25 Posted 2007-06-30 19:21 ·  中国 新疆 乌鲁木齐 电信
新手上路
Credits 18
Posts 7
Joined 2007-06-30 16:18
19-year member
UID 92776
Gender Male
Status Offline
May I ask, I made another batch file, first executing inifile, then executing other batch files, but I found that it always stops after inifile is executed. Why is this?
Floor 26 Posted 2007-07-28 21:38 ·  中国 广东 江门 电信
新手上路
Credits 2
Posts 1
Joined 2007-07-28 06:15
18-year member
UID 94164
Gender Male
From China
Status Offline
Thanks to the LZ for sharing
Floor 27 Posted 2008-01-19 12:24 ·  中国 天津 联通
新手上路
Credits 2
Posts 1
Joined 2008-01-19 11:36
18-year member
UID 108983
Gender Male
Status Offline
Learned...
Floor 28 Posted 2008-01-19 20:56 ·  中国 河南 洛阳 新安县 电信
初级用户
Credits 52
Posts 26
Joined 2008-01-16 22:16
18-year member
UID 108790
Gender Male
Status Offline
Learning
Floor 29 Posted 2008-01-21 19:30 ·  中国 广东 东莞 电信
初级用户
Credits 61
Posts 30
Joined 2008-01-16 05:45
18-year member
UID 108734
Gender Male
Status Offline
Floor 30 Posted 2008-03-12 12:11 ·  中国 广东 茂名 电信
中级用户
★★
Credits 261
Posts 123
Joined 2006-06-06 19:23
20-year member
UID 56648
Status Offline
Just about to use it, and also put forward two suggestions:
Can read all field names, such as getting


Another one is to read a field and get all item names
timeout
default

Add the function of setting variables to have the function of only displaying item values
When entering , you don't need to enter
It would be best to add a modification function, and line-by-line replacement doesn't seem too difficult.


Finally ask
if /i "!a!"=="%item%" (
if "%setvar%"=="1" (
endlocal&set "%%x"
echo %item%
I want to display the value, why doesn't it work? echo %%item%% also doesn't work

[ Last edited by yangzhiyi on 2008-3-12 at 01:05 PM ]
Forum Jump: