Link to home
Start Free TrialLog in
Avatar of vseatech
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,nDLOLNEMFileWatcheru.dll
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Ahh, Lotus notes :-)  Try this on a test INi or two... it takes a backup into notes.bak

@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_ADDINS=" 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
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_ADDINS=" 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
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%
Avatar of vseatech
vseatech

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?
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
  )
)
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_ADDINS=" 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
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_ADDINS=" call :foundit %line1:~14%
if /i "%line1:~0,17%"=="AddInMenus=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
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,nDLOLNEMFileWatcheru.dll - 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=nDLOLNEMFileWatcheru.dll

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%
Please provide some sample input that illustrates how the batch processing is not working.
And have you tried the one i have supplied?

Steve
Ya Dragon, I tried the one you provided but the problem is that it deletes the entire "EXTMGR_ADDINS=NCExtMgr,nDLOLNEMFileWatcheru.dll " 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]"...
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
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]
@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%
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 ;)
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.  
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 :)
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.
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%
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
It turns out that the data from lines 5 and 6 isn't always on lines 5 and 6.  

AddInMenus=NCMenu
EXTMGR_ADDINS=NCExtMgr,nDLOLNEMFileWatcheru.dll

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%
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,nDLOLNEMFileWatcheru.dll
SomethingElse=
AndAnother=2323
wekjwe243==2323

into this:

[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
AddInMenus=NCMenu
EXTMGR_ADDINS=nDLOLNEMFileWatcheru.dll
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_ADDINS=" 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


Actually you need to add a further line:

if "%line1%"=="AddInMenus=NCMenu" goto end after the set line1=%* to remove that line 5 but the 'line 6' worked fine for me?


Steve
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.  
Can't say without processing the files here. Can you post the files here?
****This is the original INI****
[Notes]
KitType=1
Directory=C:\notes\data
InstallType=2
AddInMenus=NCMenu
EXTMGR_ADDINS=NCExtMgr,nDLOLNEMFileWatcheru.dll
FaultRecovery_Build=Release 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,.STR,,1,
VIEWIMP3=Tabular Text,0,_ITAB,,.PRN,.RPT,.TAB,.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,.STR,,1,
VIEWEXP4=Tabular Text,1,_XTAB,,.CGN,.LTR,.RPT,.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,.RTF,,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=030042617369630000000000000000000000000000000000000000000000000000000000000001010100000A0000000000000100A0050A0000006400A0050A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009404000000000000
NAMEDSTYLE0_FACE=Default Sans Serif
NAMEDSTYLE1=030042756C6C657400000000000000000000000000000000000000000000000000000000000001010100000A000000000000000008070A000000640008070A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000049404000000000000
NAMEDSTYLE1_FACE=Default Sans Serif
NAMEDSTYLE2=0300486561646C696E6500000000000000000000000000000000000000000000000000000000010101010B0C0000000000000100A0050A0000006400A0050A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009404000000000000
NAMEDSTYLE2_FACE=Default Sans Serif
DefaultMailTemplate=mail6.ntf
DESKWINDOWSIZE=33 42 767 528
FileDlgDirectory=C:\Documents 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,COM3,SPX,COM2,COM4,COM5
KeyFilename=rmoore.id
PhoneLog=2
Log=log.nsf, 1, 0, 7, 40000
CertificateExpChecked=rmoore.id 04/19/2007
MailFile=mail\rmoore.nsf
MailServer=CN=NotesMail1/OU=SEB/O=Varian
TemplateSetup=600400
Setup=650200
Location=Office (Network),9DE,CN=Robert Moore/OU=IIS/OU=SEB/O=Varian
$IEVersionMajor=6
RequestCertTableUpdate=rmoore.id 04/20/2007
ECLSetup=3
DYNINFOCR_OF2C598276:E08346CD-ON2DB06065:C521F41D=OF5BB2D1B5:E97E74D4-ON60096882:0C6F5CD5
$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:007306FD
DontCheckDefaultMail=1
NewMailSeqNum=2304
NewMailSeqNum852571F5:007B126E=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
EnableJavaScriptErrorDialogs=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=633 517 323 305
FINDSTRING1=jared
FINDSTRING2=Corey
FINDSTRING3=beamon
$W3LocalFormSave=0
IM_DYN_GROUP_OPEN_STATE=0
FINDSTRING4=isabel
ChooseNameDlgColWidths=124,124,124,124,9999,
WindowSizeAmbiguousDialog=467 430 656 307
$DialogMode=0
WindowSizeNameSoundexMailing=467 430 656 307
$EnableAlarms=1
CalendarTimeSlotStart=420
CalendarTimeSlotEnd=1140
CalendarTimeSlotDuration=60
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,520,845,
NameAddressingDlgLastViewName=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,1082,516,836,
SelectNamesDialogSize=491,1087,516,870,
URLAddress5=\\us-vcsvss-d1a\ConfigFile
WindowSizeBrowse=641 518 322 325
WindowSizeCalendarEmodal=495 523 608 522
URLAddress6=http://www.penny-arcade.com/comic/2007/03/09
WindowSizeReplSeverList=614 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=nDLOLNEMFileWatcheru.dll
FaultRecovery_Build=Release 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,.STR,,1,
VIEWIMP3=Tabular Text,0,_ITAB,,.PRN,.RPT,.TAB,.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,.STR,,1,
VIEWEXP4=Tabular Text,1,_XTAB,,.CGN,.LTR,.RPT,.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,.RTF,,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=030042617369630000000000000000000000000000000000000000000000000000000000000001010100000A0000000000000100A0050A0000006400A0050A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009404000000000000
NAMEDSTYLE0_FACE=Default Sans Serif
NAMEDSTYLE1=030042756C6C657400000000000000000000000000000000000000000000000000000000000001010100000A000000000000000008070A000000640008070A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000049404000000000000
NAMEDSTYLE1_FACE=Default Sans Serif
NAMEDSTYLE2=0300486561646C696E6500000000000000000000000000000000000000000000000000000000010101010B0C0000000000000100A0050A0000006400A0050A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009404000000000000
NAMEDSTYLE2_FACE=Default Sans Serif
DefaultMailTemplate=mail6.ntf
DESKWINDOWSIZE=33 42 767 528
FileDlgDirectory=C:\Documents 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,COM3,SPX,COM2,COM4,COM5
KeyFilename=rmoore.id
PhoneLog=2
Log=log.nsf, 1, 0, 7, 40000
CertificateExpChecked=rmoore.id 04/19/2007
MailFile=mail\rmoore.nsf
MailServer=CN=NotesMail1/OU=SEB/O=Varian
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.
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.
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=Company
(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.
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
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!
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
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 !