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 22:00
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Share] Batch Processing to Read INI File View 13,215 Replies 44
Original Poster Posted 2006-12-19 01:49 ·  中国 福建 泉州 石狮市 电信
银牌会员
★★★
Credits 1,276
Posts 469
Joined 2002-12-23 13:00
23-year member
UID 586
Gender Male
From 福建泉州
Status Offline
Recent Ratings for This Post ( 3 in total) Click for details
RaterScoreTime
electronixtar +11 2007-03-14 02:40
yangzhiyi +2 2007-03-17 08:11
0401 +4 2007-03-17 09:27
Attachments
inifile.rar (1012 bytes, Credits to download 1 pts, Downloads: 237)
QQ:366840202
http://chenall.net
Floor 2 Posted 2006-12-19 01:54 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
It is suggested that Brother chenall post the content in the attachment in the form of code at the top of the thread, so as to facilitate everyone to directly discuss the content of the post and also facilitate you to update the code.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 3 Posted 2006-12-19 02:01 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
There is a problem with the test, and it prompts that the command syntax is incorrect.
Floor 4 Posted 2006-12-19 02:02 ·  中国 福建 泉州 石狮市 电信
银牌会员
★★★
Credits 1,276
Posts 469
Joined 2002-12-23 13:00
23-year member
UID 586
Gender Male
From 福建泉州
Status Offline
Hehe, the current processing method doesn't feel very good yet. Hope someone can come up with a better approach.
QQ:366840202
http://chenall.net
Floor 5 Posted 2006-12-19 02:03 ·  中国 福建 泉州 石狮市 电信
银牌会员
★★★
Credits 1,276
Posts 469
Joined 2002-12-23 13:00
23-year member
UID 586
Gender Male
From 福建泉州
Status Offline
Originally posted by HUNRYBECKY at 2006-12-19 02:01 AM:
There is a problem with the test, and it prompts that the command syntax is incorrect.

Please post the command you used.

Running without parameters will also have this prompt. I'll modify it later.
It may be because there is no "".
It is recommended to use "" for all added parameters.
Example:
inifile "c:\boot.ini" "" "timeout"

The code on the first floor has been updated, but the attachment has not been updated. You can modify it according to the code on the first floor.
if not exist %1 goto :file_err
Change the line to move to
if not exist %filepath% goto :file_err

[ Last edited by chenall on 2006-12-19 at 02:08 AM ]
QQ:366840202
http://chenall.net
Floor 6 Posted 2006-12-19 02:11 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
I'm not sure about the specific context and whether it can be accurately translated in a very precise technical sense here. But the text you provided is:

  对 boot.ini 的格式和含义不甚了解,chenall 兄能否帖一个极度BT的示范例子出来,要求里面要出现尽可能多的特殊情况:比如特殊字符啦、比如空行啦、比如光标定位在某行的末尾而不是定位在最后一个空行上啦……只有把最BT的情形都考虑到了,做出来的代码才具备最大的兼容性。

Translated:
I don't know much about the format and meaning of boot.ini. Brother chenall, can you post an extremely BT sample example? It is required to have as many special cases as possible: such as special characters, such as blank lines, such as the cursor being positioned at the end of a line instead of at the last blank line... Only by considering all the most BT situations can the made code have the greatest compatibility.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 7 Posted 2006-12-19 02:16 ·  中国 福建 泉州 石狮市 电信
银牌会员
★★★
Credits 1,276
Posts 469
Joined 2002-12-23 13:00
23-year member
UID 586
Gender Male
From 福建泉州
Status Offline
For formats like this:
[xxxx]
aaabbbddd ;aaaaaaaaa
cccccccccc ;aaaaaaaaaa
;The content after ; is not read. Because ; is a comment.
You can try the INF file in the system. I haven't encountered problems so far.
Because this is for reading information in the INF file.
The example uses BOOT.INI for simplicity.
QQ:366840202
http://chenall.net
Floor 8 Posted 2007-03-13 12:10 ·  中国 河南 商丘 永城市 联通
新手上路
Credits 14
Posts 6
Joined 2007-03-13 11:34
19-year member
UID 81598
Gender Male
Status Offline
Double-clicking has no response, it flashes by. How to use it? Oh no
Floor 9 Posted 2007-03-13 12:26 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Originally posted by oumigaiiii at 2007-3-12 23:10:
Double-clicking has no response and it flashes by. How to use it? Oh no



  Take a look at the usage method written by the original poster earlier!
Floor 10 Posted 2007-03-13 13:10 ·  中国 河南 商丘 永城市 联通
新手上路
Credits 14
Posts 6
Joined 2007-03-13 11:34
19-year member
UID 81598
Gender Male
Status Offline
Originally posted by lxmxn at 2007-3-12 11:26 PM:



  Look at the usage method written by the original poster above!

I read it, where do I enter those lines in that example??? How to call it???
Floor 11 Posted 2007-03-13 13:14 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Originally posted by oumigaiiii at 2007-3-13 00:10:
I saw, where to input those lines in that example??? How to call it???


  Call it in the command prompt CMD and batch files, and run it with parameters. For example: "inifile c:\windows\control.ini", in a batch file, it can be: "call inifile c:\windows\control.ini"
Floor 12 Posted 2007-03-14 01:05 ·  中国 广东 广州 番禺区 电信
中级用户
★★
脚本爱好者
Credits 238
Posts 93
Joined 2007-03-11 13:38
19-year member
UID 81417
Gender Male
From GZ
Status Offline
Let's study it, because I also need such a program.
Floor 13 Posted 2007-03-14 02:41 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Forgot to add points, make it up

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 14 Posted 2007-03-14 03:39 ·  中国 广东 茂名 电信
中级用户
★★
Credits 261
Posts 123
Joined 2006-06-06 19:23
20-year member
UID 56648
Status Offline
Floor 15 Posted 2007-03-17 07:52 ·  中国 广东 茂名 电信
中级用户
★★
Credits 261
Posts 123
Joined 2006-06-06 19:23
20-year member
UID 56648
Status Offline
There is still one parameter missing. There should be another function to read out the value of the project. For example, timeout=3 gets 3. Now inifile c:\boot.ini "[boot loader]" timeout
:: Display the value of timeout in the [boot loader] section of c:\boot.ini
Can only read out as
timeout=3
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
+1 2009-12-10 12:09
Forum Jump: