There is my problem:
I would like to modify *.ini file. I need modify three things - three steps code:
1. modify 2lines
2. add some text to line9.
3. remove line9
original ini:
Code: Select all
[OPTIONS]
GlobalDataPath=Y:
//GlobalDataPath=c:\Program Files\EM\_base_ladeni
OnStart=
OnExit=
ShowDebug=1
ActPhase=3
Sound=0
[EMs]
Enabled=0000000001000000000000000000000000000000
SaveReadOut=1
CheckIDDuplicit=1
[TEPLOMER]
Enabled=0
Default=23.0
[LAST_OPENED]
zak=LET13561.zak
1. modify 2lines :
Code: Select all
[OPTIONS]
GlobalDataPath=Z:
//GlobalDataPath=c:\Program Files\EM\_base_ladeni
OnStart=
OnExit=
ShowDebug=1
ActPhase=3
Sound=0
[EMs]
Enabled=0000000001000000000000000000000000000000
SaveReadOut=1
CheckIDDuplicit=1
[TEPLOMER]
Enabled=0
Default=23.0
[LAST_OPENED]
zak=LET13561.zak
2. add some text to line9:
Code: Select all
[OPTIONS]
GlobalDataPath=Z:
//GlobalDataPath=c:\Program Files\EM\_base_ladeni
OnStart=
OnExit=
ShowDebug=1
ActPhase=3
Sound=0
CheckedOperation="55"
[EMs]
Enabled=0000000001000000000000000000000000000000
SaveReadOut=1
CheckIDDuplicit=1
[TEPLOMER]
Enabled=0
Default=23.0
[LAST_OPENED]
zak=LET13561.zak
3. remove line9 : (remove: CheckedOperation="55")
Code: Select all
[OPTIONS]
GlobalDataPath=Y:
//GlobalDataPath=c:\Program Files\EM\_base_ladeni
OnStart=
OnExit=
ShowDebug=1
ActPhase=3
Sound=0
[EMs]
Enabled=0000000001000000000000000000000000000000
SaveReadOut=1
CheckIDDuplicit=1
[TEPLOMER]
Enabled=0
Default=23.0
[LAST_OPENED]
zak=LET13561.zak
I tried to use findrepl:
1. modify 2lines
Code: Select all
type "c:\Program Files\em\CalForm\CalForm.ini"|findrepl /LINE2 "GlobalDataPath=Y" "GlobalDataPath=Z" >"c:\Program Files\em\CalForm\CalForm.ini"
2. add some text to line9
Code: Select all
@echo off
(
type "c:\Program Files\em\CalForm\CalForm.ini"|findrepl /o:1:8
echo CheckedOperation="55"
type "c:\Program Files\em\CalForm\CalForm.ini"|findrepl /o:9
) > "c:\Program Files\em\CalForm\CalForm.tmp"
type "c:\Program Files\em\CalForm\CalForm.tmp" >"c:\Program Files\em\CalForm\CalForm.ini"
del /q "c:\Program Files\em\CalForm\CalForm.tmp"
3. remove line9
Code: Select all
type "c:\Program Files\em\CalForm\CalForm.ini"|findrepl.bat /v /o:9:9 >"c:\Program Files\em\CalForm\CalForm.ini"
Everything works ok .... but sometimes findrepl generate bug :
C: \ Program Files \ EM \ CalForm \ findrepl.bat (784, 4) Microsoft JScript - Runtime Error: The input end of the file
What to do?
Thanks Sosna
(Win XP/SP3)