Read Write INI File By Batch Command

¹èÄ¡ ÆÄÀÏ¿¡¼­ INI ÆÄÀÏÀ» ÀÐ°í ¾²´Â ¹æ¹ý¿¡ ´ëÇؼ­ ¾Ë¾Æ º»´Ù.
¼Ò½º´Â Âü°í »çÀÌÆ®¿¡¼­ °¡Á® ¿Ô´Ù.

INI ÆÄÀÏÀ» ¾²°í, INI ÆÄÀÏÀ» ÀÐ¾î ¿Í¼­ º¯¼ö·Î ÀÔ·Â Çغ¸ÀÚ.

´ÙÀ½°ú °°Àº Test.ini ÆÄÀÏÀÌ ÀÖ´Ù.
[SectionName]
; This is a comment.
total=4

[AnotherSectionName]
# This is another comment.
TestValue=88

[OtherSectionName]
And it should work with non-standard comments as well.
total=-1

1. ¸ÕÀú ¹èÄ¡ ÆÄÀÏ·Î ¾²±â, Àб⿡ ´ëÇؼ­ ¾Ë¾Æ º»´Ù.

¾²±â
call ini.bat /i TestValue /v 88   /s AnotherSectionName  test.ini

/s : ¼½¼Ç
/i : ¾ÆÀÌÅÛ
/v : °ª

Àбâ
call ini.bat /i TestValue /s AnotherSectionName  test.ini

¾Æ±Ô¸ÕÆ®(Àü´ÞÀÎÀÚ) /v ¸¦ »ý·«Çϸé ÀбⰡ µÈ´Ù.

2. °ªÀ» Àоî¿Ã¶§ º¯¼ö·Î »ç¿ëÇϱâ

°ªÀ» Àоî¿Ã¶§ °á°ú°ªÀ» È­¸é¿¡ ±×³É Ãâ·ÂÇØ ¹ö¸°´Ù.
°á°ú°ªÀ» º¯¼ö·Î »ç¿ëÇÏ´Â ¹æ¹ý¿¡ ´ëÇؼ­ ¾Ë¾Æ º»´Ù.

for  /f  "tokens=1  delims=  " %%a  IN  ('call ini.bat /i TestValue /s AnotherSectionName  test.ini')  do  set result=%%a

echo %result%

¹èÄ¡ ÆÄÀÏ ½ÇÇà °á°ú¸¦ result º¯¼ö¿¡ ³Ö°í ÀÖ´Ù.

°á°ú:
D:\Test>Test.bat
88

ini.bat
test.ini
test.bat

Âü°í)
ini.bat ÆÄÀÏ ¼Ò½º °¡Á®¿Â°÷
https://del4u.tistory.com/131

¹èÄ¡ÆÄÀÏ¿¡¼­ ¸í·ÉÀÇ È­¸é Ãâ·Â°ªÀ» º¯¼ö·Î ÀÔ·ÂÇϱâ
https://mchch.tistory.com/94