vseatech
asked on
Automate Edit of an INI with a BAT
I need to create a .bat that will modify an .ini. Line 5 in the .ini is static and it needs to be deleted. Line 6 is my variable. On line 6 if there is nothing after the "=" then the entire line needs to be deleted. If there is anything after the "=" then ONLY "NCExtMgr" needs to be deleted and anything else in that line needs to stay. So I need an 'IF' statement that'll delete line 5 if true and then for line 6 either delete it if "EXTMGR_Addins=" exists, otherwise only find and delete "NCExtMgr" if anything exists after the "=".
The .bat I created is rubbish so I need a hand with creating something (start from scratch when replying with a solution - I need to work this from the ground up).
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
AddInMenus=NCMenu
EXTMGR_ADDINS=NCExtMgr,nDL OLNEMFileW atcheru.dl l
The .bat I created is rubbish so I need a hand with creating something (start from scratch when replying with a solution - I need to work this from the ground up).
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
AddInMenus=NCMenu
EXTMGR_ADDINS=NCExtMgr,nDL
Actually that will break the lines that end in 1 or 2 due to that being taken as part of the redirect symbol. Try this:
rem @Echo off
copy notes.ini notes.bak /y
del notes.old 2>NUL
rename notes.ini notes.old
for /f "Tokens=*" %%a in (notes.old) do call :process %%a
goto end
:process
set line1=%*
if "%line1%"=="" echo.>>notes.ini & goto end
if /i "%line1:~0,14%"=="EXTMGR_A DDINS=" call :foundit %line1:~14%
(echo %line1%)>> notes.ini
goto end
:foundit
REM Check if NCEXtMgr is starting line and remove it.
set line2=%*
if /i "%line2:~0,9%"=="NCExtMgr, " set line1=%line1:~0,14%%line2: ~9%
:end
rem @Echo off
copy notes.ini notes.bak /y
del notes.old 2>NUL
rename notes.ini notes.old
for /f "Tokens=*" %%a in (notes.old) do call :process %%a
goto end
:process
set line1=%*
if "%line1%"=="" echo.>>notes.ini & goto end
if /i "%line1:~0,14%"=="EXTMGR_A
(echo %line1%)>> notes.ini
goto end
:foundit
REM Check if NCEXtMgr is starting line and remove it.
set line2=%*
if /i "%line2:~0,9%"=="NCExtMgr,
:end
Here's my version:
@echo off
setlocal
if "%~1"=="" echo usage: %0 fileName [outFile]&goto :EOF
if not exist "%~1" echo %1 does not exist&goto :EOF
set outFile=%~n1.out
if not "%~2"=="" set outFile=%~2
del "%outFile%" 2>NUL
set nCnt=0
for /f "tokens=1,* delims==" %%a in ('type "%~1"') do call :PROCESS "%%a" "%%b"
echo Output in %outFile%
goto :EOF
:PROCESS
set /a nCnt+=1
if /i %nCnt% EQU 5 goto :EOF
if /i %nCnt% NEQ 6 goto WRITELINE
if "%~2"=="" goto :EOF
set p2=%~2
if /i "%p2:~0,9%"=="NCExtMgr," (echo %~1=%p2:~9%)>>"%outFile%"& goto :EOF
(echo %~1=%~2)>>"%outFile%
goto :EOF
:WRITELINE
set p1=%~1
if "%p1:~0,1%"=="[" (echo %~1)>>"%outFile%"&goto :EOF
(echo %~1=%~2)>>"%outFile%
@echo off
setlocal
if "%~1"=="" echo usage: %0 fileName [outFile]&goto :EOF
if not exist "%~1" echo %1 does not exist&goto :EOF
set outFile=%~n1.out
if not "%~2"=="" set outFile=%~2
del "%outFile%" 2>NUL
set nCnt=0
for /f "tokens=1,* delims==" %%a in ('type "%~1"') do call :PROCESS "%%a" "%%b"
echo Output in %outFile%
goto :EOF
:PROCESS
set /a nCnt+=1
if /i %nCnt% EQU 5 goto :EOF
if /i %nCnt% NEQ 6 goto WRITELINE
if "%~2"=="" goto :EOF
set p2=%~2
if /i "%p2:~0,9%"=="NCExtMgr," (echo %~1=%p2:~9%)>>"%outFile%"&
(echo %~1=%~2)>>"%outFile%
goto :EOF
:WRITELINE
set p1=%~1
if "%p1:~0,1%"=="[" (echo %~1)>>"%outFile%"&goto :EOF
(echo %~1=%~2)>>"%outFile%
ASKER
Steve, at first glance your suggestion looks more like it's right up my alley. Dragon-it, unless I'm mistaken, you're suggesting I delete notes.old before I even have it renamed to notes.old, but maybe I'm missing something there.
So Steve, now that I've got an example like yours to work from, I'll tweak and test it and see what I get. If AddInMenus=NCMenu exists, which it will on each .ini then I want it deleted...and if there's any text after EXTMGR_ADDINS= then I want only NCExtMgr deleted, otherwise if there's nothing after the "=" then I want the entire line removed. But I'm a little confused at first glance on where exactly I need to assign those commands, without messing up what you've provided. Think you could offer some insight?
So Steve, now that I've got an example like yours to work from, I'll tweak and test it and see what I get. If AddInMenus=NCMenu exists, which it will on each .ini then I want it deleted...and if there's any text after EXTMGR_ADDINS= then I want only NCExtMgr deleted, otherwise if there's nothing after the "=" then I want the entire line removed. But I'm a little confused at first glance on where exactly I need to assign those commands, without messing up what you've provided. Think you could offer some insight?
If you want to test for AddInMenus=NCMenu, you'd do that in the PROCESS routine WRITELINE routine.
%~1 is the left value and %~2 is the right value:
if /i "%~1"=="AddInMenus" (
if /i "%~2"=="NCMenu" (
goto :EOF
)
)
%~1 is the left value and %~2 is the right value:
if /i "%~1"=="AddInMenus" (
if /i "%~2"=="NCMenu" (
goto :EOF
)
)
My suggestion took deleted any previous version of notes.old, renamed the current notes.ini to notes.old to use as a source file then re-wrote the file into notes.ini. It also takes a backup copy into notes.bak 'just in case'.
As it stands it does all that you asked except it leaves the EXTMGR_ADDINS= bit in if the rest of the line would be blank.
Just feed it a notes.ini file and try it... there should rarely be any special characters such as <>^& etc. in a notes.ini file but be aware that if there is it can cause seamingly odd effects when editing with a batch file like these.
You can add a check for the blank entry by adding a line at the end and a check to exclude putting a blank line in it's place.
Steve
rem @Echo off
copy notes.ini notes.bak /y
del notes.old 2>NUL
rename notes.ini notes.old
for /f "Tokens=*" %%a in (notes.old) do call :process %%a
goto end
:process
set line1=%*
if "%line1%"=="" echo.>>notes.ini & goto end
if /i "%line1:~0,14%"=="EXTMGR_A DDINS=" call :foundit %line1:~14%
if not "%line1%"=="" (echo %line1%)>> notes.ini
goto end
:foundit
REM Check if NCEXtMgr is starting line and remove it.
set line2=%*
if /i "%line2:~0,9%"=="NCExtMgr, " set line1=%line1:~0,14%%line2: ~9%
if "%line1%"=="" set line1=""
:end
Steve
As it stands it does all that you asked except it leaves the EXTMGR_ADDINS= bit in if the rest of the line would be blank.
Just feed it a notes.ini file and try it... there should rarely be any special characters such as <>^& etc. in a notes.ini file but be aware that if there is it can cause seamingly odd effects when editing with a batch file like these.
You can add a check for the blank entry by adding a line at the end and a check to exclude putting a blank line in it's place.
Steve
rem @Echo off
copy notes.ini notes.bak /y
del notes.old 2>NUL
rename notes.ini notes.old
for /f "Tokens=*" %%a in (notes.old) do call :process %%a
goto end
:process
set line1=%*
if "%line1%"=="" echo.>>notes.ini & goto end
if /i "%line1:~0,14%"=="EXTMGR_A
if not "%line1%"=="" (echo %line1%)>> notes.ini
goto end
:foundit
REM Check if NCEXtMgr is starting line and remove it.
set line2=%*
if /i "%line2:~0,9%"=="NCExtMgr,
if "%line1%"=="" set line1=""
:end
Steve
And to add the other clause I missed to remove the AddInMenus line:
@Echo off
copy notes.ini notes.bak /y
del notes.old 2>NUL
rename notes.ini notes.old
for /f "Tokens=*" %%a in (notes.old) do call :process %%a
goto end
:process
set line1=%*
if "%line1%"=="" echo.>>notes.ini & goto end
if /i "%line1:~0,14%"=="EXTMGR_A DDINS=" call :foundit %line1:~14%
if /i "%line1:~0,17%"=="AddInMen us=NCMenu" goto end
if not "%line1%"=="" (echo %line1%)>> notes.ini
goto end
:foundit
REM Check if NCEXtMgr is starting line and remove it.
set line2=%*
if /i "%line2:~0,9%"=="NCExtMgr, " set line1=%line1:~0,14%%line2: ~9%
if "%line1%"=="" set line1=""
:end
@Echo off
copy notes.ini notes.bak /y
del notes.old 2>NUL
rename notes.ini notes.old
for /f "Tokens=*" %%a in (notes.old) do call :process %%a
goto end
:process
set line1=%*
if "%line1%"=="" echo.>>notes.ini & goto end
if /i "%line1:~0,14%"=="EXTMGR_A
if /i "%line1:~0,17%"=="AddInMen
if not "%line1%"=="" (echo %line1%)>> notes.ini
goto end
:foundit
REM Check if NCEXtMgr is starting line and remove it.
set line2=%*
if /i "%line2:~0,9%"=="NCExtMgr,
if "%line1%"=="" set line1=""
:end
ASKER
So here's what I'm working with. The ini is located in C:\notes\. I've been having a few issues trying to get this to run successfully. This is back to the original suggestion from Steve...what needs to be modified in order for this to work properly?
NOTE: AddInMenus=NCMenu needs to be deleted.
NOTE: EXTMGR_ADDINS=NCExtMgr,nDL OLNEMFileW atcheru.dl l - If there's no entry after the = sign then EXTMGR_ADDINS= needs to be deleted. If there is an entry after the = sign then "NCExtMgr," needs to be deleted so the entry would show as EXTMGR_ADDINS=nDLOLNEMFile Watcheru.d ll
Basically I'm really just looking for the below .bat to be rewritten so it's complete, and I can just use it as is. I'd assign 10,000pts if i could!
@echo off
setlocal
if "%~1"=="" echo usage: %0 fileName [outFile]&goto :EOF
if not exist "%~1" echo %1 does not exist&goto :EOF
set outFile=%~n1.out
if not "%~2"=="" set outFile=%~2
del "%outFile%" 2>NUL
set nCnt=0
for /f "tokens=1,* delims==" %%a in ('type "%~1"') do call :PROCESS "%%a" "%%b"
echo Output in %outFile%
goto :EOF
:PROCESS
set /a nCnt+=1
if /i %nCnt% EQU 5 goto :EOF
if /i %nCnt% NEQ 6 goto WRITELINE
if "%~2"=="" goto :EOF
set p2=%~2
if /i "%p2:~0,9%"=="NCExtMgr," (echo %~1=%p2:~9%)>>"%outFile%"& goto :EOF
(echo %~1=%~2)>>"%outFile%
goto :EOF
:WRITELINE
set p1=%~1
if "%p1:~0,1%"=="[" (echo %~1)>>"%outFile%"&goto :EOF
(echo %~1=%~2)>>"%outFile%
NOTE: AddInMenus=NCMenu needs to be deleted.
NOTE: EXTMGR_ADDINS=NCExtMgr,nDL
Basically I'm really just looking for the below .bat to be rewritten so it's complete, and I can just use it as is. I'd assign 10,000pts if i could!
@echo off
setlocal
if "%~1"=="" echo usage: %0 fileName [outFile]&goto :EOF
if not exist "%~1" echo %1 does not exist&goto :EOF
set outFile=%~n1.out
if not "%~2"=="" set outFile=%~2
del "%outFile%" 2>NUL
set nCnt=0
for /f "tokens=1,* delims==" %%a in ('type "%~1"') do call :PROCESS "%%a" "%%b"
echo Output in %outFile%
goto :EOF
:PROCESS
set /a nCnt+=1
if /i %nCnt% EQU 5 goto :EOF
if /i %nCnt% NEQ 6 goto WRITELINE
if "%~2"=="" goto :EOF
set p2=%~2
if /i "%p2:~0,9%"=="NCExtMgr," (echo %~1=%p2:~9%)>>"%outFile%"&
(echo %~1=%~2)>>"%outFile%
goto :EOF
:WRITELINE
set p1=%~1
if "%p1:~0,1%"=="[" (echo %~1)>>"%outFile%"&goto :EOF
(echo %~1=%~2)>>"%outFile%
Please provide some sample input that illustrates how the batch processing is not working.
And have you tried the one i have supplied?
Steve
Steve
ASKER
Ya Dragon, I tried the one you provided but the problem is that it deletes the entire "EXTMGR_ADDINS=NCExtMgr,nD LOLNEMFile Watcheru.d ll " string. I need it to only delete "NCExtMgr," if there's text after the "=".
Notes.bak gets created.
/F "Tokens=*" %a in (notes.old) do call :process %a
call :process [Notes]
set line1 =[Notes]
if "[Notes]" == "" echo. 1>>notes.ini & goto end
if /I "[Notes]" == "EXTMGR_ADDINS=" call :foundit
if not "[Notes]" == "" (echo [Notes] ) 1>>notes.ini
goto end
and then it runs 1 file(s) copied about 30 times.
When I check the ini both entries are deleted entirely.
SteveGTR when I run your batch it comes up with:
"usage: "C:\Documents and Settings\username\Desktop\ Copy of Notes.bat" filename [outFile]"...
Notes.bak gets created.
/F "Tokens=*" %a in (notes.old) do call :process %a
call :process [Notes]
set line1 =[Notes]
if "[Notes]" == "" echo. 1>>notes.ini & goto end
if /I "[Notes]" == "EXTMGR_ADDINS=" call :foundit
if not "[Notes]" == "" (echo [Notes] ) 1>>notes.ini
goto end
and then it runs 1 file(s) copied about 30 times.
When I check the ini both entries are deleted entirely.
SteveGTR when I run your batch it comes up with:
"usage: "C:\Documents and Settings\username\Desktop\
That means that you should enter the name of the ini filename and an optional output file name. If none is given the output file will be the name of the ini filename specified plus .out. For example:
Copy of Notes.bat my.ini
Will write output to my.out
Copy of Notes.bat my.ini new.ini
Will write output to new.ini
Copy of Notes.bat my.ini
Will write output to my.out
Copy of Notes.bat my.ini new.ini
Will write output to new.ini
ASKER
can you illustrate it in the batch process you offered? because I changed filename and outfile but I still get the same issue so I fear I'm entering it incorrectly.
So you do this:
1) Cut and paste the contents of my batch processing as posted above into a file name "Copy of Notes.bat"
2) Execute something like this:
"Copy of Notes.bat" your.ini new.ini
And you get this message?
Copy of Notes.bat fileName [outFile]
1) Cut and paste the contents of my batch processing as posted above into a file name "Copy of Notes.bat"
2) Execute something like this:
"Copy of Notes.bat" your.ini new.ini
And you get this message?
Copy of Notes.bat fileName [outFile]
ASKER
@echo off
setlocal
if "%~1"=="" echo usage: %0 notes.ini [new.ini]&goto :EOF
if not exist "%~1" echo %1 does not exist&goto :EOF
set outFile=%~n1.out
if not "%~2"=="" set outFile=%~2
del "%outFile%" 2>NUL
set nCnt=0
for /f "tokens=1,* delims==" %%a in ('type "%~1"') do call :PROCESS "%%a" "%%b"
echo Output in %outFile%
goto :EOF
:PROCESS
set /a nCnt+=1
if /i %nCnt% EQU 5 goto :EOF
if /i %nCnt% NEQ 6 goto WRITELINE
if "%~2"=="" goto :EOF
set p2=%~2
if /i "%p2:~0,9%"=="NCExtMgr," (echo %~1=%p2:~9%)>>"%outFile%"& goto :EOF
(echo %~1=%~2)>>"%outFile%
goto :EOF
:WRITELINE
set p1=%~1
if "%p1:~0,1%"=="[" (echo %~1)>>"%outFile%"&goto :EOF
(echo %~1=%~2)>>"%outFile%
setlocal
if "%~1"=="" echo usage: %0 notes.ini [new.ini]&goto :EOF
if not exist "%~1" echo %1 does not exist&goto :EOF
set outFile=%~n1.out
if not "%~2"=="" set outFile=%~2
del "%outFile%" 2>NUL
set nCnt=0
for /f "tokens=1,* delims==" %%a in ('type "%~1"') do call :PROCESS "%%a" "%%b"
echo Output in %outFile%
goto :EOF
:PROCESS
set /a nCnt+=1
if /i %nCnt% EQU 5 goto :EOF
if /i %nCnt% NEQ 6 goto WRITELINE
if "%~2"=="" goto :EOF
set p2=%~2
if /i "%p2:~0,9%"=="NCExtMgr," (echo %~1=%p2:~9%)>>"%outFile%"&
(echo %~1=%~2)>>"%outFile%
goto :EOF
:WRITELINE
set p1=%~1
if "%p1:~0,1%"=="[" (echo %~1)>>"%outFile%"&goto :EOF
(echo %~1=%~2)>>"%outFile%
Can you answer my question?
I see your new to EE.
To allow use to help you, you must read our messages and respond to the questions we asked. We are at a disadvantage in that we can't see what you are doing on your end, nor are we very good at reading minds ;)
To allow use to help you, you must read our messages and respond to the questions we asked. We are at a disadvantage in that we can't see what you are doing on your end, nor are we very good at reading minds ;)
ASKER
Steve, if you look at what I changed in my last post, I showed you what I changed.
if "%~1"=="" echo usage: %0 notes.ini [new.ini]&goto :EOF (notes.ini)
if not exist "%~1" echo %1 does not exist&goto :EOF
I didn't sign up for insults really, I just want some help creating this .bat file. What I've been asking is if you, knowing all the information there is, can help me modify the batch process you offered. If you can input the correct data so it's correct, I should then just be able to post it into a text file and make a .bat with it.
if "%~1"=="" echo usage: %0 notes.ini [new.ini]&goto :EOF (notes.ini)
if not exist "%~1" echo %1 does not exist&goto :EOF
I didn't sign up for insults really, I just want some help creating this .bat file. What I've been asking is if you, knowing all the information there is, can help me modify the batch process you offered. If you can input the correct data so it's correct, I should then just be able to post it into a text file and make a .bat with it.
I should have reread that last post. Even with the wink ;) at the end I can see how you could feel insulted. I'm sorry.
Now, please try the following.
1) Use my original code exactly as I posted and name it test.bat.
2) Run the following command using the name of your ini file in place of input.ini:
test input.ini
3) Post back any error messages you receive. Or if it works, then post back the input.out file.
4) Comment on any problems with regard to the processing.
That would help if you could do that for me. Thanks :)
Now, please try the following.
1) Use my original code exactly as I posted and name it test.bat.
2) Run the following command using the name of your ini file in place of input.ini:
test input.ini
3) Post back any error messages you receive. Or if it works, then post back the input.out file.
4) Comment on any problems with regard to the processing.
That would help if you could do that for me. Thanks :)
ASKER
I must be missing something, I'm sure it's painfully obvious, but what input.ini are you referring to? Are you saying go to Start, Run and try test notes.ini? or in the cmd prompt?
All this is done at the command prompt.
ASKER
Steve, it seems to work just fine. So how do I now instead of getting the notes.out file to get created, I need it to output notes.ini so it replaces the original notes.ini automatically.
I modified the batch file to replace the input file if not outFile is given on the command line:
@echo off
setlocal
if "%~1"=="" echo usage: %0 fileName [outFile]&goto :EOF
if not exist "%~1" echo %1 does not exist&goto :EOF
set outFile=%~n1.out
if not "%~2"=="" set outFile=%~2
del "%outFile%" 2>NUL
set nCnt=0
for /f "tokens=1,* delims==" %%a in ('type "%~1"') do call :PROCESS "%%a" "%%b"
if not "%~2"=="" echo Output in %outFile%&goto :EOF
copy "%outFile%" "%inFile%"
del "%outFile%"
echo %inFile% updated with changes
goto :EOF
:PROCESS
set /a nCnt+=1
if /i %nCnt% EQU 5 goto :EOF
if /i %nCnt% NEQ 6 goto WRITELINE
if "%~2"=="" goto :EOF
set p2=%~2
if /i "%p2:~0,9%"=="NCExtMgr," (echo %~1=%p2:~9%)>>"%outFile%"& goto :EOF
(echo %~1=%~2)>>"%outFile%
goto :EOF
:WRITELINE
set p1=%~1
if "%p1:~0,1%"=="[" (echo %~1)>>"%outFile%"&goto :EOF
(echo %~1=%~2)>>"%outFile%
@echo off
setlocal
if "%~1"=="" echo usage: %0 fileName [outFile]&goto :EOF
if not exist "%~1" echo %1 does not exist&goto :EOF
set outFile=%~n1.out
if not "%~2"=="" set outFile=%~2
del "%outFile%" 2>NUL
set nCnt=0
for /f "tokens=1,* delims==" %%a in ('type "%~1"') do call :PROCESS "%%a" "%%b"
if not "%~2"=="" echo Output in %outFile%&goto :EOF
copy "%outFile%" "%inFile%"
del "%outFile%"
echo %inFile% updated with changes
goto :EOF
:PROCESS
set /a nCnt+=1
if /i %nCnt% EQU 5 goto :EOF
if /i %nCnt% NEQ 6 goto WRITELINE
if "%~2"=="" goto :EOF
set p2=%~2
if /i "%p2:~0,9%"=="NCExtMgr," (echo %~1=%p2:~9%)>>"%outFile%"&
(echo %~1=%~2)>>"%outFile%
goto :EOF
:WRITELINE
set p1=%~1
if "%p1:~0,1%"=="[" (echo %~1)>>"%outFile%"&goto :EOF
(echo %~1=%~2)>>"%outFile%
ASKER
When I run this new mod it does the same thing and creats the notes.out. When I rename the file to notes.ini it's correct, thanks for getting that part to work. But I need to be able to take the contents of this bat, add it to another bat and have it modify the already existing notes.ini instead of creating a seperate notes.out output file. Can you help me with this last tweak? Thanks for your help thus far Steve!
You would now want to run the batch processing without an output file. Like so:
test.bat notes.ini
This should issue a message stating that "notes.ini updated with changes"
If you wanted to integrate this processing into another batch file you could do it many ways. I'd suggest leaving it as is and simply calling the batch processing from within the other batch file:
call test.bat notes.ini
test.bat notes.ini
This should issue a message stating that "notes.ini updated with changes"
If you wanted to integrate this processing into another batch file you could do it many ways. I'd suggest leaving it as is and simply calling the batch processing from within the other batch file:
call test.bat notes.ini
ASKER
It turns out that the data from lines 5 and 6 isn't always on lines 5 and 6.
AddInMenus=NCMenu
EXTMGR_ADDINS=NCExtMgr,nDL OLNEMFileW atcheru.dl l
So I need the .bat modified so that instead of searching for these entries on a specifc line, it just searches for the entires regardless of the line they're on. I've been playing around with the .bat trying to get it to run as needed but I haven't been able to successfully figure it out. Any suggestions guys?
AddInMenus=NCMenu
EXTMGR_ADDINS=NCExtMgr,nDL
So I need the .bat modified so that instead of searching for these entries on a specifc line, it just searches for the entires regardless of the line they're on. I've been playing around with the .bat trying to get it to run as needed but I haven't been able to successfully figure it out. Any suggestions guys?
Try this:
@echo off
setlocal
if "%~1"=="" echo usage: %0 notes.ini [new.ini]&goto :EOF
if not exist "%~1" echo %1 does not exist&goto :EOF
set outFile=%~n1.out
if not "%~2"=="" set outFile=%~2
del "%outFile%" 2>NUL
for /f "tokens=1,* delims==" %%a in ('type "%~1"') do call :PROCESS "%%a" "%%b"
echo Output in %outFile%
goto :EOF
:PROCESS
if /i "%~1"=="AddInMenus" goto :EOF
if /i not "%~1"=="EXTMGR_ADDINS" goto WRITELINE
if "%~2"=="" goto :EOF
set p2=%~2
if /i "%p2:~0,9%"=="NCExtMgr," (echo %~1=%p2:~9%)>>"%outFile%"& goto :EOF
(echo %~1=%~2)>>"%outFile%
goto :EOF
:WRITELINE
set p1=%~1
if "%p1:~0,1%"=="[" (echo %~1)>>"%outFile%"&goto :EOF
(echo %~1=%~2)>>"%outFile%
@echo off
setlocal
if "%~1"=="" echo usage: %0 notes.ini [new.ini]&goto :EOF
if not exist "%~1" echo %1 does not exist&goto :EOF
set outFile=%~n1.out
if not "%~2"=="" set outFile=%~2
del "%outFile%" 2>NUL
for /f "tokens=1,* delims==" %%a in ('type "%~1"') do call :PROCESS "%%a" "%%b"
echo Output in %outFile%
goto :EOF
:PROCESS
if /i "%~1"=="AddInMenus" goto :EOF
if /i not "%~1"=="EXTMGR_ADDINS" goto WRITELINE
if "%~2"=="" goto :EOF
set p2=%~2
if /i "%p2:~0,9%"=="NCExtMgr," (echo %~1=%p2:~9%)>>"%outFile%"&
(echo %~1=%~2)>>"%outFile%
goto :EOF
:WRITELINE
set p1=%~1
if "%p1:~0,1%"=="[" (echo %~1)>>"%outFile%"&goto :EOF
(echo %~1=%~2)>>"%outFile%
I still believe me batch file posted before works as described... though there seems some reluctance to try it for some reason. It turns this text in notes.ini
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
AddInMenus=NCMenu
EXTMGR_ADDINS=NCExtMgr,nDL OLNEMFileW atcheru.dl l
SomethingElse=
AndAnother=2323
wekjwe243==2323
into this:
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
AddInMenus=NCMenu
EXTMGR_ADDINS=nDLOLNEMFile Watcheru.d ll
SomethingElse=
AndAnother=2323
wekjwe243==2323
leaving the old version in notes.bak and using a temporary file notes.old for working.
Steve
@Echo off
copy notes.ini notes.bak /y
del notes.old 2>NUL
rename notes.ini notes.old
for /f "Tokens=*" %%a in (notes.old) do call :process %%a
goto end
:process
set line1=%*
if "%line1%"=="" echo.>>notes.ini & goto end
if /i "%line1:~0,14%"=="EXTMGR_A DDINS=" call :foundit %line1:~14%
(echo %line1%)>> notes.ini
goto end
:foundit
REM Check if NCEXtMgr is starting line and remove it.
set line2=%*
if /i "%line2:~0,9%"=="NCExtMgr, " set line1=%line1:~0,14%%line2: ~9%
:end
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
AddInMenus=NCMenu
EXTMGR_ADDINS=NCExtMgr,nDL
SomethingElse=
AndAnother=2323
wekjwe243==2323
into this:
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
AddInMenus=NCMenu
EXTMGR_ADDINS=nDLOLNEMFile
SomethingElse=
AndAnother=2323
wekjwe243==2323
leaving the old version in notes.bak and using a temporary file notes.old for working.
Steve
@Echo off
copy notes.ini notes.bak /y
del notes.old 2>NUL
rename notes.ini notes.old
for /f "Tokens=*" %%a in (notes.old) do call :process %%a
goto end
:process
set line1=%*
if "%line1%"=="" echo.>>notes.ini & goto end
if /i "%line1:~0,14%"=="EXTMGR_A
(echo %line1%)>> notes.ini
goto end
:foundit
REM Check if NCEXtMgr is starting line and remove it.
set line2=%*
if /i "%line2:~0,9%"=="NCExtMgr,
:end
Actually you need to add a further line:
if "%line1%"=="AddInMenus=NCM enu" goto end after the set line1=%* to remove that line 5 but the 'line 6' worked fine for me?
Steve
if "%line1%"=="AddInMenus=NCM
Steve
ASKER
SteveGTR, this is good stuff. I see now what my mistakes were in the Process to Writeline. My only problems now are that when I create a notesb.ini outFile "notes.bat notes.ini notesb.ini" everything after the 98th line gets deleted in the .ini. And another thing is for some reason, when running "notes.bat notes.ini" in a cmd prompt instead of "notes.ini updated with changes" I get "9DE was unexpected at this time." and then a notes.out file gets created. I rename the notes.out file to notesb.ini and everything is still cut off after the 98th line. The 9DE is the value I get on my computer, but on another system it might be 8GF or something else. ( the original test.bat has been renamed to notes.bat ).
Dragon-it, I just figured that since I've been working with GTR and it seems that I'm fairly close I mind as well follow through and continue on the current path.
Dragon-it, I just figured that since I've been working with GTR and it seems that I'm fairly close I mind as well follow through and continue on the current path.
Can't say without processing the files here. Can you post the files here?
ASKER
****This is the original INI****
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
AddInMenus=NCMenu
EXTMGR_ADDINS=NCExtMgr,nDL OLNEMFileW atcheru.dl l
FaultRecovery_Build=Releas e 6.5.2
DSTLAW=3,2,1,11,1,1
UPDATE_TIMER=10/12/2005 07:53:45 PM
SUDIALOG_ON=0
Timezone=5
DST=1
MailType=0
$$HasLANPort=1
WWWDSP_SYNC_BROWSERCACHE=0
WWWDSP_PREFETCH_OBJECT=0
EnableJavaApplets=1
EnablePlugins=1
Preferences=-1744829327
AltNameLanguage=en
ContentLanguage=en-US
WeekStart=1
ViewWeekStart=2
NavWeekStart=1
XLATE_CSID=52
SPELL_LANG=1033
SPELL_PREFERENCES=0
Region=en-US
DatePickerDirection=0
Passthru_LogLevel=0
Console_LogLevel=2
VIEWIMP1=Lotus 1-2-3,0,_IWKSV,,.123,.WK1, .WK3,.WK4, .WKS,.WR1, .WRK,,4,
VIEWIMP2=Structured Text,0,_ISTR,,.CGN,.LTR,.S TR,,1,
VIEWIMP3=Tabular Text,0,_ITAB,,.PRN,.RPT,.T AB,.TXT,,1 ,
VIEWIMP4=vCard,0,_IVCRD,,. VCF,,1,
VIEWEXP1=Comma Separated Value,0,_XCSV,,.CSV,,1,
VIEWEXP2=Lotus 1-2-3,0,_XWKS,,.123,.WK1,. WK3,.WK4,. WKS,.WR1,. WRK,,4,
VIEWEXP3=Structured Text,0,_XSTR,,.CGN,.LTR,.S TR,,1,
VIEWEXP4=Tabular Text,1,_XTAB,,.CGN,.LTR,.R PT,.TAB,,1 ,
VIEWEXP5=vCard 2.1,0,_XVCRD,,.VCF,,1,
VIEWEXP6=vCard 3.0,0,_XVCRD3,,.VCF,,1,
EDITIMP1=ASCII Text,0,_ITEXT,,.C,.H,.PRN, .RIP,.TXT, ,1,
EDITIMP2=Binary with Text,0,_ISTRNGS,,.*,,1,
EDITIMP3=BMP Image,0,_IBMP,,.BMP,,18,
EDITIMP4=CGM Image,0,_IFL,,.CGM,.GMF,,8 ,
EDITIMP5=GIF Image,0,_IGIF,,.GIF,,18,
EDITIMP6=HTML File,0,_IHTML,,.HTM,.HTML, ,1,
EDITIMP7=JPEG Image,0,_IJPEG,,.JPG,,18,
EDITIMP8=Lotus 1-2-3,0,_IW4W,_IWKSE,.123, .WK1,.WK3, .WK4,.WKS, .WR1,.WRK, ,4,
EDITIMP9=Lotus PIC,0,_IPIC,,.PIC,,8,
EDITIMP10=Lotus Word Pro,0,_IW4W,,.LWP,,2,
EDITIMP11=Microsoft Excel,0,_IW4W,,.XLS,,4,
EDITIMP12=Microsoft RTF,0,_IW4W,_IRTF,.DOC,.RT F,,2,
EDITIMP13=Microsoft Word,0,_IW4W,,.DOC,,2,
EDITIMP14=PCX Image,0,_IPCX,,.PCX,,18,
EDITIMP15=TIFF 5.0 Image,0,_ITIFF,,.TIF,,18,
EDITIMP16=WordPerfect 5.x,0,_IW4W,,.DOC,.WPD,,2,
EDITIMP17=WordPerfect 6.0/6.1,0,_IW4W,,.DOC,.WPD ,.WPT,,2,
EDITEXP1=ASCII Text,2,_XTEXT,,.C,.H,.PRN, .RIP,.TXT, ,1,
EDITEXP2=CGM Image,2,_XCGM,,.CGM,.GMF,, 8,
EDITEXP3=Microsoft RTF,2,_XRTF,,.DOC,.RTF,,4,
EDITEXP4=TIFF 5.0 Image,2,_XTIFF,,.TIF,,18,
EDITEXP5=vCard 2.1,0,XVCRD,,.VCF,,1,
EDITEXP6=vCard 3.0,0,XVCRD3,,.VCF,,1,
DDETimeout=10
NAMEDSTYLE0=03004261736963 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0001010100 000A000000 0000000100 A0050A0000 006400A005 0A00000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0094040000 00000000
NAMEDSTYLE0_FACE=Default Sans Serif
NAMEDSTYLE1=030042756C6C65 7400000000 0000000000 0000000000 0000000000 0000000000 0000000000 0001010100 000A000000 0000000000 08070A0000 0064000807 0A00000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0494040000 00000000
NAMEDSTYLE1_FACE=Default Sans Serif
NAMEDSTYLE2=0300486561646C 696E650000 0000000000 0000000000 0000000000 0000000000 0000000000 0001010101 0B0C000000 0000000100 A0050A0000 006400A005 0A00000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0094040000 00000000
NAMEDSTYLE2_FACE=Default Sans Serif
DefaultMailTemplate=mail6. ntf
DESKWINDOWSIZE=33 42 767 528
FileDlgDirectory=C:\Docume nts and Settings\rmoore\Desktop
TCPIP=TCP, 0, 15, 0
LAN0=NETBIOS,0,15,0,,12288 ,
SPX=NWSPX, 0, 15, 0
COM1=XPC,1,15,0,,12288,
COM2=XPC,2,15,0,
COM3=XPC,3,15,0,,12288,
COM4=XPC,4,15,0,
COM5=XPC,5,15,0,
Ports=TCPIP
DisabledPorts=LAN0,COM1,CO M3,SPX,COM 2,COM4,COM 5
KeyFilename=rmoore.id
PhoneLog=2
Log=log.nsf, 1, 0, 7, 40000
CertificateExpChecked=rmoo re.id 04/19/2007
MailFile=mail\rmoore.nsf
MailServer=CN=NotesMail1/O U=SEB/O=Va rian
TemplateSetup=600400
Setup=650200
Location=Office (Network),9DE,CN=Robert Moore/OU=IIS/OU=SEB/O=Vari an
$IEVersionMajor=6
RequestCertTableUpdate=rmo ore.id 04/20/2007
ECLSetup=3
DYNINFOCR_OF2C598276:E0834 6CD-ON2DB0 6065:C521F 41D=OF5BB2 D1B5:E97E7 4D4-ON6009 6882:0C6F5 CD5
$MIMESaveFormat=0
MIMEPromptMultilingual=1
CSEnblRstTm=0
DeskIconColors=0
ReplDefPartDocsLimitAmt=0
ReplDefPartAtchLimitAmt=0
ReplDefEncrypt=1
ReplDefEncryptType=2
ReplDefReplImmed=1
MIMEMultilingualMode=2
MIMETmpMultilingual=3
MailSetup=650200
MailUpgradeFolder=650200
$headlineClientId=9DFA5ECE :9BD30ACD- 85257273:0 07306FD
DontCheckDefaultMail=1
NewMailSeqNum=2304
NewMailSeqNum852571F5:007B 126E=2304
LastHistoryPruneTime=04/20 /2007 07:56:33 AM
WindowSizeKeywords=644 517 299 275
BCASE_SITEMAP_DISPLAY=13
FINDSTRING0=Charlene
WindowMoreStateSearch=0
NAMES=names.nsf, mobiledir.nsf
ReplDefFullDocs=1
ReplDefPartDocsLimit=0
ReplDefPartAtchLimit=0
ReplDefFullText=0
$headlineDisableHeadlines= 0
PromptForLocation=0
EmptyTrash=0
UNICODE_Display=1
AltCalendar=0
QuotePrefix=>
QuoteLineLength=70
IM_ENABLE_SSO=1
EnableActiveXInBrowser=1
EnableJavaScript=1
EnableJavaScriptErrorDialo gs=1
EnableLiveConnect=1
BackgroundPrinting=1
ShowAccelerators=1
DisableImageDithering=1
NewMailInterval=5
WINDOWSIZEWIN=108 284 1375 885
MAXIMIZED=0
SPELL_DLL=ltspln50.dll
SPELL_DIR=C:\notes\data
BuddyListVisible=0
BuddyListPos=1349 779 243 389
WindowMoreStateNewRepl=1
WindowSizeUpdateDesign=634 430 323 106
HELPWINDOWSIZEWIN=143 409 1314 761
HELPMAXIMIZED=0
WindowSizeChooseServers=63 3 517 323 305
FINDSTRING1=jared
FINDSTRING2=Corey
FINDSTRING3=beamon
$W3LocalFormSave=0
IM_DYN_GROUP_OPEN_STATE=0
FINDSTRING4=isabel
ChooseNameDlgColWidths=124 ,124,124,1 24,9999,
WindowSizeAmbiguousDialog= 467 430 656 307
$DialogMode=0
WindowSizeNameSoundexMaili ng=467 430 656 307
$EnableAlarms=1
CalendarTimeSlotStart=420
CalendarTimeSlotEnd=1140
CalendarTimeSlotDuration=6 0
WindowSizeBrowseAlarms=525 430 541 289
WindowSizeBrowseDForms=609 519 371 260
WindowSizeViewNew=574 142 451 408
$CreateBookmarkLastFolder= Favorite Bookmarks
WindowSizeBookmark=613 142 374 309
MultiRoomDlgSize=495,1082, 516,836,
WindowSizeOpenDoc=524 517 548 297
SelectAddressesDialogSize= 501,1097,5 20,845,
NameAddressingDlgLastViewN ame=0,List by name
Win32InfoboxPos=2 110
WindowSizeToolbarPrefs=494 455 593 499
WindowSizePickKeywords=591 525 403 314
URLAddress1=http://www.homelandsecurityus.com/
URLAddress2=http://hotair.com/archives/2007/04/11/todays-must-reads/
URLAddress3=http://video.google.com/videoplay?docid=-7320960375181402397&q=ferrari+vs+f1&hl=en
URLAddress4=http://www.thinkgeek.com/computing/accessories/8a0f/
MultiResourceDlgSize=495,1 082,516,83 6,
SelectNamesDialogSize=491, 1087,516,8 70,
URLAddress5=\\us-vcsvss-d1 a\ConfigFi le
WindowSizeBrowse=641 518 322 325
WindowSizeCalendarEmodal=4 95 523 608 522
URLAddress6=http://www.penny-arcade.com/comic/2007/03/09
WindowSizeReplSeverList=61 4 368 332 240
WindowSizeReplSettings=494 368 572 403
URLAddress7=http://www.gizmag.com/go/3603/
URLAddress8=http://www.welectronics.com/Bluetooth/SONYERICSSON_HBH-300.html
URLAddress9=http://www.gsmarena.com/blackberry_pearl_8100-1701.php
AutoFadeIMContactList=50
URLAddress10=http://www.gamespot.com/games.html?type=bc&platform=1029&page_type=games&tag=subnav;xbox_compat
****This is the notesb.ini****
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
EXTMGR_ADDINS=nDLOLNEMFile Watcheru.d ll
FaultRecovery_Build=Releas e 6.5.2
DSTLAW=3,2,1,11,1,1
UPDATE_TIMER=10/12/2005 07:53:45 PM
SUDIALOG_ON=0
Timezone=5
DST=1
MailType=0
$$HasLANPort=1
WWWDSP_SYNC_BROWSERCACHE=0
WWWDSP_PREFETCH_OBJECT=0
EnableJavaApplets=1
EnablePlugins=1
Preferences=-1744829327
AltNameLanguage=en
ContentLanguage=en-US
WeekStart=1
ViewWeekStart=2
NavWeekStart=1
XLATE_CSID=52
SPELL_LANG=1033
SPELL_PREFERENCES=0
Region=en-US
DatePickerDirection=0
Passthru_LogLevel=0
Console_LogLevel=2
VIEWIMP1=Lotus 1-2-3,0,_IWKSV,,.123,.WK1, .WK3,.WK4, .WKS,.WR1, .WRK,,4,
VIEWIMP2=Structured Text,0,_ISTR,,.CGN,.LTR,.S TR,,1,
VIEWIMP3=Tabular Text,0,_ITAB,,.PRN,.RPT,.T AB,.TXT,,1 ,
VIEWIMP4=vCard,0,_IVCRD,,. VCF,,1,
VIEWEXP1=Comma Separated Value,0,_XCSV,,.CSV,,1,
VIEWEXP2=Lotus 1-2-3,0,_XWKS,,.123,.WK1,. WK3,.WK4,. WKS,.WR1,. WRK,,4,
VIEWEXP3=Structured Text,0,_XSTR,,.CGN,.LTR,.S TR,,1,
VIEWEXP4=Tabular Text,1,_XTAB,,.CGN,.LTR,.R PT,.TAB,,1 ,
VIEWEXP5=vCard 2.1,0,_XVCRD,,.VCF,,1,
VIEWEXP6=vCard 3.0,0,_XVCRD3,,.VCF,,1,
EDITIMP1=ASCII Text,0,_ITEXT,,.C,.H,.PRN, .RIP,.TXT, ,1,
EDITIMP2=Binary with Text,0,_ISTRNGS,,.*,,1,
EDITIMP3=BMP Image,0,_IBMP,,.BMP,,18,
EDITIMP4=CGM Image,0,_IFL,,.CGM,.GMF,,8 ,
EDITIMP5=GIF Image,0,_IGIF,,.GIF,,18,
EDITIMP6=HTML File,0,_IHTML,,.HTM,.HTML, ,1,
EDITIMP7=JPEG Image,0,_IJPEG,,.JPG,,18,
EDITIMP8=Lotus 1-2-3,0,_IW4W,_IWKSE,.123, .WK1,.WK3, .WK4,.WKS, .WR1,.WRK, ,4,
EDITIMP9=Lotus PIC,0,_IPIC,,.PIC,,8,
EDITIMP10=Lotus Word Pro,0,_IW4W,,.LWP,,2,
EDITIMP11=Microsoft Excel,0,_IW4W,,.XLS,,4,
EDITIMP12=Microsoft RTF,0,_IW4W,_IRTF,.DOC,.RT F,,2,
EDITIMP13=Microsoft Word,0,_IW4W,,.DOC,,2,
EDITIMP14=PCX Image,0,_IPCX,,.PCX,,18,
EDITIMP15=TIFF 5.0 Image,0,_ITIFF,,.TIF,,18,
EDITIMP16=WordPerfect 5.x,0,_IW4W,,.DOC,.WPD,,2,
EDITIMP17=WordPerfect 6.0/6.1,0,_IW4W,,.DOC,.WPD ,.WPT,,2,
EDITEXP1=ASCII Text,2,_XTEXT,,.C,.H,.PRN, .RIP,.TXT, ,1,
EDITEXP2=CGM Image,2,_XCGM,,.CGM,.GMF,, 8,
EDITEXP3=Microsoft RTF,2,_XRTF,,.DOC,.RTF,,4,
EDITEXP4=TIFF 5.0 Image,2,_XTIFF,,.TIF,,18,
EDITEXP5=vCard 2.1,0,XVCRD,,.VCF,,1,
EDITEXP6=vCard 3.0,0,XVCRD3,,.VCF,,1,
DDETimeout=10
NAMEDSTYLE0=03004261736963 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0001010100 000A000000 0000000100 A0050A0000 006400A005 0A00000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0094040000 00000000
NAMEDSTYLE0_FACE=Default Sans Serif
NAMEDSTYLE1=030042756C6C65 7400000000 0000000000 0000000000 0000000000 0000000000 0000000000 0001010100 000A000000 0000000000 08070A0000 0064000807 0A00000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0494040000 00000000
NAMEDSTYLE1_FACE=Default Sans Serif
NAMEDSTYLE2=0300486561646C 696E650000 0000000000 0000000000 0000000000 0000000000 0000000000 0001010101 0B0C000000 0000000100 A0050A0000 006400A005 0A00000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0094040000 00000000
NAMEDSTYLE2_FACE=Default Sans Serif
DefaultMailTemplate=mail6. ntf
DESKWINDOWSIZE=33 42 767 528
FileDlgDirectory=C:\Docume nts and Settings\rmoore\Desktop
TCPIP=TCP, 0, 15, 0
LAN0=NETBIOS,0,15,0,,12288 ,
SPX=NWSPX, 0, 15, 0
COM1=XPC,1,15,0,,12288,
COM2=XPC,2,15,0,
COM3=XPC,3,15,0,,12288,
COM4=XPC,4,15,0,
COM5=XPC,5,15,0,
Ports=TCPIP
DisabledPorts=LAN0,COM1,CO M3,SPX,COM 2,COM4,COM 5
KeyFilename=rmoore.id
PhoneLog=2
Log=log.nsf, 1, 0, 7, 40000
CertificateExpChecked=rmoo re.id 04/19/2007
MailFile=mail\rmoore.nsf
MailServer=CN=NotesMail1/O U=SEB/O=Va rian
TemplateSetup=600400
Setup=650200
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
AddInMenus=NCMenu
EXTMGR_ADDINS=NCExtMgr,nDL
FaultRecovery_Build=Releas
DSTLAW=3,2,1,11,1,1
UPDATE_TIMER=10/12/2005 07:53:45 PM
SUDIALOG_ON=0
Timezone=5
DST=1
MailType=0
$$HasLANPort=1
WWWDSP_SYNC_BROWSERCACHE=0
WWWDSP_PREFETCH_OBJECT=0
EnableJavaApplets=1
EnablePlugins=1
Preferences=-1744829327
AltNameLanguage=en
ContentLanguage=en-US
WeekStart=1
ViewWeekStart=2
NavWeekStart=1
XLATE_CSID=52
SPELL_LANG=1033
SPELL_PREFERENCES=0
Region=en-US
DatePickerDirection=0
Passthru_LogLevel=0
Console_LogLevel=2
VIEWIMP1=Lotus 1-2-3,0,_IWKSV,,.123,.WK1,
VIEWIMP2=Structured Text,0,_ISTR,,.CGN,.LTR,.S
VIEWIMP3=Tabular Text,0,_ITAB,,.PRN,.RPT,.T
VIEWIMP4=vCard,0,_IVCRD,,.
VIEWEXP1=Comma Separated Value,0,_XCSV,,.CSV,,1,
VIEWEXP2=Lotus 1-2-3,0,_XWKS,,.123,.WK1,.
VIEWEXP3=Structured Text,0,_XSTR,,.CGN,.LTR,.S
VIEWEXP4=Tabular Text,1,_XTAB,,.CGN,.LTR,.R
VIEWEXP5=vCard 2.1,0,_XVCRD,,.VCF,,1,
VIEWEXP6=vCard 3.0,0,_XVCRD3,,.VCF,,1,
EDITIMP1=ASCII Text,0,_ITEXT,,.C,.H,.PRN,
EDITIMP2=Binary with Text,0,_ISTRNGS,,.*,,1,
EDITIMP3=BMP Image,0,_IBMP,,.BMP,,18,
EDITIMP4=CGM Image,0,_IFL,,.CGM,.GMF,,8
EDITIMP5=GIF Image,0,_IGIF,,.GIF,,18,
EDITIMP6=HTML File,0,_IHTML,,.HTM,.HTML,
EDITIMP7=JPEG Image,0,_IJPEG,,.JPG,,18,
EDITIMP8=Lotus 1-2-3,0,_IW4W,_IWKSE,.123,
EDITIMP9=Lotus PIC,0,_IPIC,,.PIC,,8,
EDITIMP10=Lotus Word Pro,0,_IW4W,,.LWP,,2,
EDITIMP11=Microsoft Excel,0,_IW4W,,.XLS,,4,
EDITIMP12=Microsoft RTF,0,_IW4W,_IRTF,.DOC,.RT
EDITIMP13=Microsoft Word,0,_IW4W,,.DOC,,2,
EDITIMP14=PCX Image,0,_IPCX,,.PCX,,18,
EDITIMP15=TIFF 5.0 Image,0,_ITIFF,,.TIF,,18,
EDITIMP16=WordPerfect 5.x,0,_IW4W,,.DOC,.WPD,,2,
EDITIMP17=WordPerfect 6.0/6.1,0,_IW4W,,.DOC,.WPD
EDITEXP1=ASCII Text,2,_XTEXT,,.C,.H,.PRN,
EDITEXP2=CGM Image,2,_XCGM,,.CGM,.GMF,,
EDITEXP3=Microsoft RTF,2,_XRTF,,.DOC,.RTF,,4,
EDITEXP4=TIFF 5.0 Image,2,_XTIFF,,.TIF,,18,
EDITEXP5=vCard 2.1,0,XVCRD,,.VCF,,1,
EDITEXP6=vCard 3.0,0,XVCRD3,,.VCF,,1,
DDETimeout=10
NAMEDSTYLE0=03004261736963
NAMEDSTYLE0_FACE=Default Sans Serif
NAMEDSTYLE1=030042756C6C65
NAMEDSTYLE1_FACE=Default Sans Serif
NAMEDSTYLE2=0300486561646C
NAMEDSTYLE2_FACE=Default Sans Serif
DefaultMailTemplate=mail6.
DESKWINDOWSIZE=33 42 767 528
FileDlgDirectory=C:\Docume
TCPIP=TCP, 0, 15, 0
LAN0=NETBIOS,0,15,0,,12288
SPX=NWSPX, 0, 15, 0
COM1=XPC,1,15,0,,12288,
COM2=XPC,2,15,0,
COM3=XPC,3,15,0,,12288,
COM4=XPC,4,15,0,
COM5=XPC,5,15,0,
Ports=TCPIP
DisabledPorts=LAN0,COM1,CO
KeyFilename=rmoore.id
PhoneLog=2
Log=log.nsf, 1, 0, 7, 40000
CertificateExpChecked=rmoo
MailFile=mail\rmoore.nsf
MailServer=CN=NotesMail1/O
TemplateSetup=600400
Setup=650200
Location=Office (Network),9DE,CN=Robert Moore/OU=IIS/OU=SEB/O=Vari
$IEVersionMajor=6
RequestCertTableUpdate=rmo
ECLSetup=3
DYNINFOCR_OF2C598276:E0834
$MIMESaveFormat=0
MIMEPromptMultilingual=1
CSEnblRstTm=0
DeskIconColors=0
ReplDefPartDocsLimitAmt=0
ReplDefPartAtchLimitAmt=0
ReplDefEncrypt=1
ReplDefEncryptType=2
ReplDefReplImmed=1
MIMEMultilingualMode=2
MIMETmpMultilingual=3
MailSetup=650200
MailUpgradeFolder=650200
$headlineClientId=9DFA5ECE
DontCheckDefaultMail=1
NewMailSeqNum=2304
NewMailSeqNum852571F5:007B
LastHistoryPruneTime=04/20
WindowSizeKeywords=644 517 299 275
BCASE_SITEMAP_DISPLAY=13
FINDSTRING0=Charlene
WindowMoreStateSearch=0
NAMES=names.nsf, mobiledir.nsf
ReplDefFullDocs=1
ReplDefPartDocsLimit=0
ReplDefPartAtchLimit=0
ReplDefFullText=0
$headlineDisableHeadlines=
PromptForLocation=0
EmptyTrash=0
UNICODE_Display=1
AltCalendar=0
QuotePrefix=>
QuoteLineLength=70
IM_ENABLE_SSO=1
EnableActiveXInBrowser=1
EnableJavaScript=1
EnableJavaScriptErrorDialo
EnableLiveConnect=1
BackgroundPrinting=1
ShowAccelerators=1
DisableImageDithering=1
NewMailInterval=5
WINDOWSIZEWIN=108 284 1375 885
MAXIMIZED=0
SPELL_DLL=ltspln50.dll
SPELL_DIR=C:\notes\data
BuddyListVisible=0
BuddyListPos=1349 779 243 389
WindowMoreStateNewRepl=1
WindowSizeUpdateDesign=634
HELPWINDOWSIZEWIN=143 409 1314 761
HELPMAXIMIZED=0
WindowSizeChooseServers=63
FINDSTRING1=jared
FINDSTRING2=Corey
FINDSTRING3=beamon
$W3LocalFormSave=0
IM_DYN_GROUP_OPEN_STATE=0
FINDSTRING4=isabel
ChooseNameDlgColWidths=124
WindowSizeAmbiguousDialog=
$DialogMode=0
WindowSizeNameSoundexMaili
$EnableAlarms=1
CalendarTimeSlotStart=420
CalendarTimeSlotEnd=1140
CalendarTimeSlotDuration=6
WindowSizeBrowseAlarms=525
WindowSizeBrowseDForms=609
WindowSizeViewNew=574 142 451 408
$CreateBookmarkLastFolder=
WindowSizeBookmark=613 142 374 309
MultiRoomDlgSize=495,1082,
WindowSizeOpenDoc=524 517 548 297
SelectAddressesDialogSize=
NameAddressingDlgLastViewN
Win32InfoboxPos=2 110
WindowSizeToolbarPrefs=494
WindowSizePickKeywords=591
URLAddress1=http://www.homelandsecurityus.com/
URLAddress2=http://hotair.com/archives/2007/04/11/todays-must-reads/
URLAddress3=http://video.google.com/videoplay?docid=-7320960375181402397&q=ferrari+vs+f1&hl=en
URLAddress4=http://www.thinkgeek.com/computing/accessories/8a0f/
MultiResourceDlgSize=495,1
SelectNamesDialogSize=491,
URLAddress5=\\us-vcsvss-d1
WindowSizeBrowse=641 518 322 325
WindowSizeCalendarEmodal=4
URLAddress6=http://www.penny-arcade.com/comic/2007/03/09
WindowSizeReplSeverList=61
WindowSizeReplSettings=494
URLAddress7=http://www.gizmag.com/go/3603/
URLAddress8=http://www.welectronics.com/Bluetooth/SONYERICSSON_HBH-300.html
URLAddress9=http://www.gsmarena.com/blackberry_pearl_8100-1701.php
AutoFadeIMContactList=50
URLAddress10=http://www.gamespot.com/games.html?type=bc&platform=1029&page_type=games&tag=subnav;xbox_compat
****This is the notesb.ini****
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
EXTMGR_ADDINS=nDLOLNEMFile
FaultRecovery_Build=Releas
DSTLAW=3,2,1,11,1,1
UPDATE_TIMER=10/12/2005 07:53:45 PM
SUDIALOG_ON=0
Timezone=5
DST=1
MailType=0
$$HasLANPort=1
WWWDSP_SYNC_BROWSERCACHE=0
WWWDSP_PREFETCH_OBJECT=0
EnableJavaApplets=1
EnablePlugins=1
Preferences=-1744829327
AltNameLanguage=en
ContentLanguage=en-US
WeekStart=1
ViewWeekStart=2
NavWeekStart=1
XLATE_CSID=52
SPELL_LANG=1033
SPELL_PREFERENCES=0
Region=en-US
DatePickerDirection=0
Passthru_LogLevel=0
Console_LogLevel=2
VIEWIMP1=Lotus 1-2-3,0,_IWKSV,,.123,.WK1,
VIEWIMP2=Structured Text,0,_ISTR,,.CGN,.LTR,.S
VIEWIMP3=Tabular Text,0,_ITAB,,.PRN,.RPT,.T
VIEWIMP4=vCard,0,_IVCRD,,.
VIEWEXP1=Comma Separated Value,0,_XCSV,,.CSV,,1,
VIEWEXP2=Lotus 1-2-3,0,_XWKS,,.123,.WK1,.
VIEWEXP3=Structured Text,0,_XSTR,,.CGN,.LTR,.S
VIEWEXP4=Tabular Text,1,_XTAB,,.CGN,.LTR,.R
VIEWEXP5=vCard 2.1,0,_XVCRD,,.VCF,,1,
VIEWEXP6=vCard 3.0,0,_XVCRD3,,.VCF,,1,
EDITIMP1=ASCII Text,0,_ITEXT,,.C,.H,.PRN,
EDITIMP2=Binary with Text,0,_ISTRNGS,,.*,,1,
EDITIMP3=BMP Image,0,_IBMP,,.BMP,,18,
EDITIMP4=CGM Image,0,_IFL,,.CGM,.GMF,,8
EDITIMP5=GIF Image,0,_IGIF,,.GIF,,18,
EDITIMP6=HTML File,0,_IHTML,,.HTM,.HTML,
EDITIMP7=JPEG Image,0,_IJPEG,,.JPG,,18,
EDITIMP8=Lotus 1-2-3,0,_IW4W,_IWKSE,.123,
EDITIMP9=Lotus PIC,0,_IPIC,,.PIC,,8,
EDITIMP10=Lotus Word Pro,0,_IW4W,,.LWP,,2,
EDITIMP11=Microsoft Excel,0,_IW4W,,.XLS,,4,
EDITIMP12=Microsoft RTF,0,_IW4W,_IRTF,.DOC,.RT
EDITIMP13=Microsoft Word,0,_IW4W,,.DOC,,2,
EDITIMP14=PCX Image,0,_IPCX,,.PCX,,18,
EDITIMP15=TIFF 5.0 Image,0,_ITIFF,,.TIF,,18,
EDITIMP16=WordPerfect 5.x,0,_IW4W,,.DOC,.WPD,,2,
EDITIMP17=WordPerfect 6.0/6.1,0,_IW4W,,.DOC,.WPD
EDITEXP1=ASCII Text,2,_XTEXT,,.C,.H,.PRN,
EDITEXP2=CGM Image,2,_XCGM,,.CGM,.GMF,,
EDITEXP3=Microsoft RTF,2,_XRTF,,.DOC,.RTF,,4,
EDITEXP4=TIFF 5.0 Image,2,_XTIFF,,.TIF,,18,
EDITEXP5=vCard 2.1,0,XVCRD,,.VCF,,1,
EDITEXP6=vCard 3.0,0,XVCRD3,,.VCF,,1,
DDETimeout=10
NAMEDSTYLE0=03004261736963
NAMEDSTYLE0_FACE=Default Sans Serif
NAMEDSTYLE1=030042756C6C65
NAMEDSTYLE1_FACE=Default Sans Serif
NAMEDSTYLE2=0300486561646C
NAMEDSTYLE2_FACE=Default Sans Serif
DefaultMailTemplate=mail6.
DESKWINDOWSIZE=33 42 767 528
FileDlgDirectory=C:\Docume
TCPIP=TCP, 0, 15, 0
LAN0=NETBIOS,0,15,0,,12288
SPX=NWSPX, 0, 15, 0
COM1=XPC,1,15,0,,12288,
COM2=XPC,2,15,0,
COM3=XPC,3,15,0,,12288,
COM4=XPC,4,15,0,
COM5=XPC,5,15,0,
Ports=TCPIP
DisabledPorts=LAN0,COM1,CO
KeyFilename=rmoore.id
PhoneLog=2
Log=log.nsf, 1, 0, 7, 40000
CertificateExpChecked=rmoo
MailFile=mail\rmoore.nsf
MailServer=CN=NotesMail1/O
TemplateSetup=600400
Setup=650200
The file just won't processing well in a .BAT file because of the special characters. I'll see if sirBounty has a vbs solution.
ASKER
Alright thanks. I'll keep an eye out for your post. I'm not too familiar with vbs or pearl but hopefully it'll be fairly straight forward.
The solution will be consise and more resilient then the batch file processing.
ASKER
I wanted to add, I did some further testing and it seems like in any INI the bat stops processing after this specific line
Location=Office (Network),9DE,CN=User Name/OU=IIS/OU=SEB/O=Compa ny
(the only mod I made to the above line was to conceal the person and company)
notice that the '9DE' entry is in this line...which might be "AO6" or some other value, and whatever that value is, it comes up in the cmd prompt after you run the .bat and create an outFile. Your thoughts?
Location=Office (Network),9DE,CN=User Name/OU=IIS/OU=SEB/O=Compa
(the only mod I made to the above line was to conceal the person and company)
notice that the '9DE' entry is in this line...which might be "AO6" or some other value, and whatever that value is, it comes up in the cmd prompt after you run the .bat and create an outFile. Your thoughts?
I can process past that line, but further down there is a > sign on this line:
QuotePrefix=>
The code doesn't like this and it's a pain to get it to parse this.
QuotePrefix=>
The code doesn't like this and it's a pain to get it to parse this.
ASKER
ok, I'll keep an eye out for the vbs solution. thanks Steve.
I used to use autoit for processing like this on notes.ini, here is an entry to change ini file to point desktop5 to a different drive etc. for instance. Autoit is free and can compile to an exe. easuily enough.
IniWrite, c:\\notes\\data\\desktop5. dsk, i:\\notes\\notes.ini, Notes, desktop5
IniWrite, i:\\notes\\names.nsf, i:\\notes\\notes.ini, Notes, names
IniDelete, i:\\notes\\notes.ini, Notes, desktop
But agreed VBScript should be easy enough and built in... BTW my script worked to the same point and failed in the same way as SteveGTR on your test file, my own notes.ini files processed OK all the way down but I was using custom location documents so didn't think of the default Office (Network) entries etc. causing it to choke. Mine also didn't have the QuotePrefix entry, doh!
Good luck!
Steve
IniWrite, c:\\notes\\data\\desktop5.
IniWrite, i:\\notes\\names.nsf, i:\\notes\\notes.ini, Notes, names
IniDelete, i:\\notes\\notes.ini, Notes, desktop
But agreed VBScript should be easy enough and built in... BTW my script worked to the same point and failed in the same way as SteveGTR on your test file, my own notes.ini files processed OK all the way down but I was using custom location documents so didn't think of the default Office (Network) entries etc. causing it to choke. Mine also didn't have the QuotePrefix entry, doh!
Good luck!
Steve
ASKER
tks Dragon, I tried your .bat as well and ran into the same issue. I was just writing back to fill you in but refreshed and saw your entry. I think we're all in agreement that VBS is the most feasible path at this point. I'm just waiting to hear back from GTR. Thanks again!
ASKER
Hey SteveGTR. Any update or comments from sirBounty? If you think it'd be beneficial for me to just post another thread then I'm not adverse to doing so. But I'd like to give you the credit for this since you've had significant impact on helping me resolve this. Let me know what you think.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
see
http://www.computing.net/dos/wwwboard/forum/16127.html
for info on a small file called
change
It may do what you need.
I hope this helps !
http://www.computing.net/dos/wwwboard/forum/16127.html
for info on a small file called
change
It may do what you need.
I hope this helps !
@Echo off
copy notes.ini notes.bak /y
del notes.old 2>NUL
rename notes.ini notes.old
for /f "Tokens=* delims==" %%a in (notes.old) do call :process %%a
goto end
:process
set line1=%*
if "%line1%"=="" echo.>>notes.ini & goto end
if /i "%line1:~0,14%"=="EXTMGR_A
echo %line1%>> notes.ini
goto end
:foundit
REM Check if NCEXtMgr is starting line and remove it.
set line2=%*
if /i "%line2:~0,9%"=="NCExtMgr,
:end