中国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-09-02 19:39
47,812 topics / 349,914 posts / today 0 new / 48,265 members
DOS批处理 & 脚本技术(批处理室) » [Share] Batch Processing to Read INI File
Printable Version  13,633 / 44
Floor1 chenall Posted 2006-12-19 01:49
银牌会员 Posts 469 Credits 1,276 From 福建泉州

Attachments
inifile.rar (1012 bytes)
Floor2 namejm Posted 2006-12-19 01:54
荣誉版主 Posts 1,737 Credits 5,226 From 成都
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.
Floor3 HUNRYBECKY Posted 2006-12-19 02:01
银牌会员 Posts 442 Credits 1,179
There is a problem with the test, and it prompts that the command syntax is incorrect.
Floor4 chenall Posted 2006-12-19 02:02
银牌会员 Posts 469 Credits 1,276 From 福建泉州
Hehe, the current processing method doesn't feel very good yet. Hope someone can come up with a better approach.
Floor5 chenall Posted 2006-12-19 02:03
银牌会员 Posts 469 Credits 1,276 From 福建泉州
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 ]
Floor6 namejm Posted 2006-12-19 02:11
荣誉版主 Posts 1,737 Credits 5,226 From 成都
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.
Floor7 chenall Posted 2006-12-19 02:16
银牌会员 Posts 469 Credits 1,276 From 福建泉州
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.
Floor8 oumigaiiii Posted 2007-03-13 12:10
新手上路 Posts 6 Credits 14
Double-clicking has no response, it flashes by. How to use it? Oh no
Floor9 lxmxn Posted 2007-03-13 12:26
版主 Posts 4,938 Credits 11,386
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!
Floor10 oumigaiiii Posted 2007-03-13 13:10
新手上路 Posts 6 Credits 14
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???
Floor11 lxmxn Posted 2007-03-13 13:14
版主 Posts 4,938 Credits 11,386
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"
Floor12 axi Posted 2007-03-14 01:05
中级用户 Posts 93 Credits 238 From GZ
Let's study it, because I also need such a program.
Floor13 electronixtar Posted 2007-03-14 02:41
铂金会员 Posts 2,672 Credits 7,493
Forgot to add points, make it up
Floor14 yangzhiyi Posted 2007-03-14 03:39
中级用户 Posts 123 Credits 261
Floor15 yangzhiyi Posted 2007-03-17 07:52
中级用户 Posts 123 Credits 261
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
1 2 3  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023