A good old DOS thread!!

Associate
Joined
8 Mar 2007
Posts
2,176
Location
between here and there
hey,

I'm trying to write a batch file that edit's a .ini files and copys it, and lots of other files from one pc to many.

I'm ok with the copying bit. (nice and easy ;)) but it's the editing line 15 of 150 with a ip address in a .ini file that i'm stuck on.

I suppose i could write the whole thing out and output it to a file but how could the >>c:\filename.ini be expanded over 150 lines???

any ideas??
 
I don't think you can write/read to INI files from batch files. You might be able to with VB Script but I am not 100%. You will need to look up GetPrivateProfileSection and WritePrivateProfileSection API's for reading and writing to INI files.

TrUz
 
it's possible within 'DOS' (or more accurately, I presume you are talking about the XP cmd line environment, which isn't DOS, but looks similar)

There are probably ways to do it better than this, but I would use some helper apps, specifically grep, and sed.

I'm not sure what you are actually trying to do or I'd give an example or two, but google for:

sed one liners
win 32 grep check out the -A and -B option


edit oh and a few FOR loops would probalby be handy - check out dostips.com and ss64
 
i'll explain a bit more...


I'm installing files in many sites, each site has between 2 and 10 Pc's.

The files in question are 3 that i have from a pre-made folder on the c:, but the last one is more tricky.

You can make and edit .ini files from batch. (but you have to type out the whole .ini file within the batch file).

I need to be able to make two changes to it, the ip address (changes from site to site but stays the same on machines at the same site) and the node number which has to change for every different machine it on.


short of having a choice "how many PC's do you have on this site" and lots of goto's for options 1 to 10, then typing out every ini file that it could need, is there a way to make some king of loop that can make (for example) make 4 .ini's with the same ip address in them but different machine numbers??


I can do this the long way round, which i night have to do as i need it by Wednesday, but if you can help that would be great.

cheers guys

EDIT; i can't use any third party app's due to a corporate environment.
 
Last edited:
I can't see why you can't just create the file using something along the lines of...

echo blah > file.ini

Also... i presume you are wanting to number the pc's 1 to 4 etc so that they are indivualised. Would a better option not be to store the machines MAC address in the .ini and use that to differentiate between machines?
 
i wish i could use third party app's. would make this a lot easier, but saddly no.

As for making the ini file in the way u sujest i allready am. I gotton to the point that with,

set /a number=1
:loop
echo.node = %number% >>file%number%.ini
set /a number +=1
goto loop

i can make as many files as i need with the correct information. But i need to only do, say 4 loops and then stop. is there a way of counting how many you done and then stop at a pre defined number.

something like

set /a number=1
:loop
echo.node = %number% >>file%number%.ini
set /a number +=1
if number=4 (goto end) else goto loop
:end
exit

???
 
Last edited:
the lines that i need to edit in the ini are half way though line @ number 25 and 28 of about 150.

I have just written the whole file like this

echo. >>c:\file%number%.ini
echo. setting = done >>c:\file%number%.ini
echo. nodenumber = %number% >>c:\file%number%.ini
echo. another setting = true >>c:\file%number%.ini
echo. some other line = false >>c:\file%number%.ini
echo. this is going to work = false >>c:\file%number%.ini
and so for about 150 line....

that way it makes a file called file1 then 2 with the right node number and so on...

These i can then copy and rename to the right directory on the right machine.
 
Last edited:
Code:
@echo off
REM THIS FILE LOOKS FOR NUMBER OF NODES AND IP AS PARAMETERS.
REM RUN LIKE THIS:  TESTINI.BAT 5 192.168.1.2


SETLOCAL ENABLEDELAYEDEXPANSION
SET IPADDRESS=%2 
IF EXIST C:\NODELIST.TXT DEL C:\NODELIST.TXT


FOR /F "tokens=1-10 delims=," %%G IN ("1,2,3,4,5,6,7,8,9,10") DO (
		IF %1==%%G ECHO %%G >> C:\NODELIST.TXT & GOTO :main
		IF %1==%%H ECHO %%G >> C:\NODELIST.TXT & ECHO %%H >> C:\NODELIST.TXT & GOTO :main
		IF %1==%%I ECHO %%G >> C:\NODELIST.TXT & ECHO %%H >> C:\NODELIST.TXT & ECHO %%I >> C:\NODELIST.TXT & GOTO :main
		IF %1==%%J ECHO %%G >> C:\NODELIST.TXT & ECHO %%H >> C:\NODELIST.TXT & ECHO %%I >> C:\NODELIST.TXT & ECHO %%J >> C:\NODELIST.TXT & GOTO :main
		IF %1==%%K ECHO %%G >> C:\NODELIST.TXT & ECHO %%H >> C:\NODELIST.TXT & ECHO %%I >> C:\NODELIST.TXT & ECHO %%J >> C:\NODELIST.TXT & ECHO %%K >> C:\NODELIST.TXT & GOTO :main
		IF %1==%%L ECHO %%G >> C:\NODELIST.TXT & ECHO %%H >> C:\NODELIST.TXT & ECHO %%I >> C:\NODELIST.TXT & ECHO %%J >> C:\NODELIST.TXT & ECHO %%K >> C:\NODELIST.TXT & ECHO %%L >> C:\NODELIST.TXT & GOTO :main
		IF %1==%%M ECHO %%G >> C:\NODELIST.TXT & ECHO %%H >> C:\NODELIST.TXT & ECHO %%I >> C:\NODELIST.TXT & ECHO %%J >> C:\NODELIST.TXT & ECHO %%K >> C:\NODELIST.TXT & ECHO %%L >> C:\NODELIST.TXT & ECHO %%M >> C:\NODELIST.TXT & GOTO :main
		IF %1==%%N ECHO %%G >> C:\NODELIST.TXT & ECHO %%H >> C:\NODELIST.TXT & ECHO %%I >> C:\NODELIST.TXT & ECHO %%J >> C:\NODELIST.TXT & ECHO %%K >> C:\NODELIST.TXT & ECHO %%L >> C:\NODELIST.TXT & ECHO %%M >> C:\NODELIST.TXT & ECHO %%N >> C:\NODELIST.TXT & GOTO :main
		IF %1==%%O ECHO %%G >> C:\NODELIST.TXT & ECHO %%H >> C:\NODELIST.TXT & ECHO %%I >> C:\NODELIST.TXT & ECHO %%J >> C:\NODELIST.TXT & ECHO %%K >> C:\NODELIST.TXT & ECHO %%L >> C:\NODELIST.TXT & ECHO %%M >> C:\NODELIST.TXT & ECHO %%N >> C:\NODELIST.TXT & ECHO %%O >> C:\NODELIST.TXT & GOTO :main	
		IF %1==%%P ECHO %%G >> C:\NODELIST.TXT & ECHO %%H >> C:\NODELIST.TXT & ECHO %%I >> C:\NODELIST.TXT & ECHO %%J >> C:\NODELIST.TXT & ECHO %%K >> C:\NODELIST.TXT & ECHO %%L >> C:\NODELIST.TXT & ECHO %%M >> C:\NODELIST.TXT & ECHO %%N >> C:\NODELIST.TXT & ECHO %%O >> C:\NODELIST.TXT & ECHO %%P >> C:\NODELIST.TXT & GOTO :main
)

:main


ECHO NUMBER OF COMPUTERS IS %1
ECHO IP ADDRESS IS %IPADDRESS%
ECHO.

FOR /F %%G IN (C:\NODELIST.TXT) DO (
	ECHO PROCESSING NODE=%%G, IPADDRESS=%IPADDRESS%

	TYPE C:\TESTINI1.TXT > C:\%2_%%G.TXT

	ECHO. >> C:\%2_%%G.TXT
	ECHO NODE=%%G >> C:\%2_%%G.TXT

	TYPE C:\TESTINI2.TXT >> C:\%2_%%G.TXT

	ECHO. >> C:\%2_%%G.TXT
	ECHO IPADDRESS=%IPADDRESS% >> C:\%2_%%G.TXT

	TYPE C:\TESTINI3.TXT >> C:\%2_%%G.TXT
)

DEL C:\NODELIST.TXT

That should work let us know if it doesn't

run it like this:

testini.bat 5 124.12.45.67

where 5 is the number of nodes - up to 10 , and the second param is the ip number.

It does the files names ipaddy_node.txt

edit seein your other post, you're workin the same way. Just make testini1.txt lines 1-24 of your file, testini2.txt, lines 26-27, and testini3.txt the last section. then it inserts the value in the right place. Or just echo the middle 2 lines in like you're doing.

edit again, fixed a problem. Should work correctly now.
 
Last edited:
cheers bud,

I have gone a differnet way;



here's whole batch file...(it's a biggy)

this runns well but the issues i have now is that when 10 tills are selected and "till=11" it only seems to see the first 1. this "till" value is used to tell the loop to stop copying files but it only copys to 1 machine and not 10.

any ideas?


@Echo off



set /p ip="enter ip: "

echo.
echo.
SET Choice=
SET /P Choice=Enter the amount of tills (2,3,4,5,6,7,8,9 or 10:

IF NOT "%Choice%"=="" SET Choice=%Choice:~0,1%
ECHO.
IF /I "%Choice%"=="2" GOTO 2
IF /I "%Choice%"=="3" GOTO 3
IF /I "%cHOICE%"=="4" GOTO 4
IF /I "%Choice%"=="5" GOTO 5
IF /I "%Choice%"=="6" GOTO 6
IF /I "%cHOICE%"=="7" GOTO 7
IF /I "%Choice%"=="8" GOTO 8
IF /I "%Choice%"=="9" GOTO 9
IF /I "%cHOICE%"=="10" GOTO 10


:2
set /a count=3
set /a pointer=1
goto loop

:copy3

copy c:\eft\ncrpos1.ini c:\pos\ncrpos.ini
copy c:\eft\chipnpin.xml c:\pos\chipnpin.xml
copy c:\eft\credreg.bat c:\pos\credreg.bat
mkdir c:\verifone_firmware
copy c:\eft\verifone_firmware\*.* c:\verifone_firmware\*.*

net use \\%ip%.13

copy c:\eft\ncrpos2.ini \\%ip%.13\c$\pos\ncrpos.ini
copy c:\eft\chipnpin.xml \\%ip%.13\C$\pos\chipnpin.xml
copy c:\eft\credreg.bat \\%ip%.13\c$\pos\credreg.bat
mkdir \\%ip%.13\c$\verifone_firmware
copy c:\eft\verifone_firmware\*.* \\%ip%.13\c$\verifone_firmware\*.*

del c:\eft\ncrpos1.ini
del c:\eft\ncrpos2.ini

goto end






:3
set /a count=4
set /a pointer=1
goto loop



:copy4

copy c:\eft\ncrpos1.ini c:\pos\ncrpos.ini
copy c:\eft\chipnpin.xml C:\pos\chipnpin.xml
copy c:\eft\credreg.bat c:\pos\credreg.bat
mkdir c:\verifone_firmware
copy c:\eft\verifone_firmware\*.* c:\verifone_firmware\*.*

set /a node=3
set /a num=2
set /a till=4
goto copyloop

:copyfin4

del c:\eft\ncrpos1.ini
del c:\eft\ncrpos2.ini
del c:\eft\ncrpos3.ini
goto end









:4
set /a count=5
set /a pointer=1
goto loop



:copy5

copy c:\eft\ncrpos1.ini c:\pos\ncrpos.ini
copy c:\eft\chipnpin.xml C:\pos\chipnpin.xml
copy c:\eft\credreg.bat c:\pos\credreg.bat
mkdir c:\verifone_firmware
copy c:\eft\verifone_firmware\*.* c:\verifone_firmware\*.*

set /a node=3
set /a num=2
set /a till=5
goto copyloop

:copyfin5

del c:\eft\ncrpos1.ini
del c:\eft\ncrpos2.ini
del c:\eft\ncrpos3.ini
del c:\eft\ncrpos4.ini
goto end






:5
set /a count=6
set /a pointer=1
goto loop



:copy6

copy c:\eft\ncrpos1.ini c:\pos\ncrpos.ini
copy c:\eft\chipnpin.xml C:\pos\chipnpin.xml
copy c:\eft\credreg.bat c:\pos\credreg.bat
mkdir c:\verifone_firmware
copy c:\eft\verifone_firmware\*.* c:\verifone_firmware\*.*

set /a node=3
set /a num=2
set /a till=6
goto copyloop

:copyfin6

del c:\eft\ncrpos1.ini
del c:\eft\ncrpos2.ini
del c:\eft\ncrpos3.ini
del c:\eft\ncrpos4.ini
del c:\eft\ncrpos5.ini
goto end








:6
set /a count=7
set /a pointer=1
goto loop



:copy7

copy c:\eft\ncrpos1.ini c:\pos\ncrpos.ini
copy c:\eft\chipnpin.xml C:\pos\chipnpin.xml
copy c:\eft\credreg.bat c:\pos\credreg.bat
mkdir c:\verifone_firmware
copy c:\eft\verifone_firmware\*.* c:\verifone_firmware\*.*

set /a node=3
set /a num=2
set /a till=7
goto copyloop

:copyfin7

del c:\eft\ncrpos1.ini
del c:\eft\ncrpos2.ini
del c:\eft\ncrpos3.ini
del c:\eft\ncrpos4.ini
del c:\eft\ncrpos5.ini
del c:\eft\ncrpos6.ini
goto end







:7
set /a count=8
set /a pointer=1
goto loop



:copy8

copy c:\eft\ncrpos1.ini c:\pos\ncrpos.ini
copy c:\eft\chipnpin.xml C:\pos\chipnpin.xml
copy c:\eft\credreg.bat c:\pos\credreg.bat
mkdir c:\verifone_firmware
copy c:\eft\verifone_firmware\*.* c:\verifone_firmware\*.*

set /a node=3
set /a num=2
set /a till=8
goto copyloop

:copyfin8

del c:\eft\ncrpos1.ini
del c:\eft\ncrpos2.ini
del c:\eft\ncrpos3.ini
del c:\eft\ncrpos4.ini
del c:\eft\ncrpos5.ini
del c:\eft\ncrpos6.ini
del c:\eft\ncrpos7.ini
goto end








:8
set /a count=9
set /a pointer=1
goto loop



:copy9

copy c:\eft\ncrpos1.ini c:\pos\ncrpos.ini
copy c:\eft\chipnpin.xml C:\pos\chipnpin.xml
copy c:\eft\credreg.bat c:\pos\credreg.bat
mkdir c:\verifone_firmware
copy c:\eft\verifone_firmware\*.* c:\verifone_firmware\*.*

set /a node=3
set /a num=2
set /a till=9
goto copyloop

:copyfin9

del c:\eft\ncrpos1.ini
del c:\eft\ncrpos2.ini
del c:\eft\ncrpos3.ini
del c:\eft\ncrpos4.ini
del c:\eft\ncrpos5.ini
del c:\eft\ncrpos6.ini
del c:\eft\ncrpos7.ini
del c:\eft\ncrpos8.ini
goto end






:9
set /a count=10
set /a pointer=1
goto loop



:copy10

copy c:\eft\ncrpos1.ini c:\pos\ncrpos.ini
copy c:\eft\chipnpin.xml C:\pos\chipnpin.xml
copy c:\eft\credreg.bat c:\pos\credreg.bat
mkdir c:\verifone_firmware
copy c:\eft\verifone_firmware\*.* c:\verifone_firmware\*.*

set /a node=3
set /a num=2
set /a till=10
goto copyloop

:copyfin10

del c:\eft\ncrpos1.ini
del c:\eft\ncrpos2.ini
del c:\eft\ncrpos3.ini
del c:\eft\ncrpos4.ini
del c:\eft\ncrpos5.ini
del c:\eft\ncrpos6.ini
del c:\eft\ncrpos7.ini
del c:\eft\ncrpos8.ini
del c:\eft\ncrpos9.ini
goto end




:10
set /a count=11
set /a pointer=1
goto loop



:copy11

copy c:\eft\ncrpos1.ini c:\pos\ncrpos.ini
copy c:\eft\chipnpin.xml C:\pos\chipnpin.xml
copy c:\eft\credreg.bat c:\pos\credreg.bat
mkdir c:\verifone_firmware
copy c:\eft\verifone_firmware\*.* c:\verifone_firmware\*.*

set /a node=3
set /a num=2
set /a till=11
goto copyloop

:copyfin11
echo deleting
pause
del c:\eft\ncrpos1.ini
del c:\eft\ncrpos2.ini
del c:\eft\ncrpos3.ini
del c:\eft\ncrpos4.ini
del c:\eft\ncrpos5.ini
del c:\eft\ncrpos6.ini
del c:\eft\ncrpos7.ini
del c:\eft\ncrpos8.ini
del c:\eft\ncrpos9.ini
del c:\eft\ncrpos10.ini
goto end







:copyloop

net use \\%ip%.1%node%

copy c:\eft\ncrpos%num%.ini \\%ip%.1%node%\c$\pos\ncrpos.ini
copy c:\eft\chipnpin.xml \\%ip%.1%node%\C$\pos\chipnpin.xml
copy c:\eft\credreg.bat \\%ip%.1%node%\c$\pos\credreg.bat
mkdir \\%ip%.1%node%\c$\verifone_firmware
copy c:\eft\verifone_firmware\*.* \\%ip%.1%node%\c$\verifone_firmware\*.*

echo Ip of till = %ip%.1%node%
echo Till number = %num%



set /a node +=1
set /a num +=1



if /i %num% NEQ %till% goto copyloop
goto copyfin%num%


:loop

echo. >>c:\eft\ncrpos%pointer%.ini
echo.[Generic] >>c:\eft\ncrpos%pointer%.ini
echo.UDPService=3002 >>c:\eft\ncrpos%pointer%.ini
echo.UseAlwaysExtenedMsgs1=1 >>c:\eft\ncrpos%pointer%.ini
echo.WinEPTSDirectNodeId=%pointer% >>c:\eft\ncrpos%pointer%.ini
echo.WinEPTSDirectGroupId=0 >>c:\eft\ncrpos%pointer%.ini
echo.WinEPTSDirectProtocol=2 >>c:\eft\ncrpos%pointer%.ini
echo.WinEPTSDirectKeyN5P5S=3C2E32F675C54B86 >>c:\eft\ncrpos%pointer%.ini
echo.log.Path= >>c:\eft\ncrpos%pointer%.ini
echo.log.Store= >>c:\eft\ncrpos%pointer%.ini
echo.DebugLevel=7 >>c:\eft\ncrpos%pointer%.ini
echo.DebugOnFile=1 >>c:\eft\ncrpos%pointer%.ini
echo.Server-000=U %ip%.11@5002 0 >>c:\eft\ncrpos%pointer%.ini
echo.Server-001=U %ip%.12@5002 0 >>c:\eft\ncrpos%pointer%.ini
echo.Server-002=U localhost@5002 0 >>c:\eft\ncrpos%pointer%.ini
echo. >>c:\eft\ncrpos%pointer%.ini
echo.[NCRClient: PPCashback] >>c:\eft\ncrpos%pointer%.ini
echo.Enabled=1 >>c:\eft\ncrpos%pointer%.ini
echo.Amount-Tail=00 >>c:\eft\ncrpos%pointer%.ini
echo.Amount-0=10 >>c:\eft\ncrpos%pointer%.ini
echo.Amount-1=20 >>c:\eft\ncrpos%pointer%.ini
echo.Amount-2=30 >>c:\eft\ncrpos%pointer%.ini
echo. >>c:\eft\ncrpos%pointer%.ini
echo.[NCRClient] >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.trace.Level=6 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.trace.fOnVideo=0 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.trace.fOnFile=1 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.stream.Type=1 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.hw.Type=2 >>c:\eft\ncrpos%pointer%.ini
echo.AllowManualCardData=0 >>c:\eft\ncrpos%pointer%.ini
echo.AllowSoftwarePin=1 >>c:\eft\ncrpos%pointer%.ini
echo.UseTouchScreen=1 >>c:\eft\ncrpos%pointer%.ini
echo.HideTipWND=0 >>c:\eft\ncrpos%pointer%.ini
echo.PreAuthDefaultChoice=0 >>c:\eft\ncrpos%pointer%.ini
echo.TimeoutCardData=90 >>c:\eft\ncrpos%pointer%.ini
echo.TimeoutDirectCmd=90 >>c:\eft\ncrpos%pointer%.ini
echo.TimeoutPin=30 >>c:\eft\ncrpos%pointer%.ini
echo.TimeoutSelection=30 >>c:\eft\ncrpos%pointer%.ini
echo.Event_GetCardRecon=0 >>c:\eft\ncrpos%pointer%.ini
echo.Event_GetOptionsSel=0 >>c:\eft\ncrpos%pointer%.ini
echo.EOT_Display=1 >>c:\eft\ncrpos%pointer%.ini
echo.EOT_DisplayTimeout=1 >>c:\eft\ncrpos%pointer%.ini
echo.Lock_Enabled=0 >>c:\eft\ncrpos%pointer%.ini
echo.Lock_IDPPad=0 >>c:\eft\ncrpos%pointer%.ini
echo.Lock_IDTerm=1 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.stream.com.Port=2 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.stream.com.Baud=38400 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.hw.ncr.kbdLayout=0 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.hw.ncr.fDontUseInputSTX=0 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.hw.ncr.fSplitLongOutputMsgs=0 >>c:\eft\ncrpos%pointer%.ini
echo.DisplayCurrType=0 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.hw.display.width=20 >>c:\eft\ncrpos%pointer%.ini
echo.NCRPP.hw.display.height=2 >>c:\eft\ncrpos%pointer%.ini
echo.RetriesAfterKeyedCardData=3 >>c:\eft\ncrpos%pointer%.ini
echo. >>c:\eft\ncrpos%pointer%.ini
echo.[LanguageStrings] >>c:\eft\ncrpos%pointer%.ini
echo.Res-000=R/C >>c:\eft\ncrpos%pointer%.ini
echo.Res-001=SHOP >>c:\eft\ncrpos%pointer%.ini
echo.Res-002=TERM >>c:\eft\ncrpos%pointer%.ini
echo.Res-003=MID >>c:\eft\ncrpos%pointer%.ini
echo.Res-004=C >>c:\eft\ncrpos%pointer%.ini
echo.Res-005=D >>c:\eft\ncrpos%pointer%.ini
echo.Res-006=EXP.DATE >>c:\eft\ncrpos%pointer%.ini
echo.Res-007=AUT.CODE >>c:\eft\ncrpos%pointer%.ini
echo.Res-008=OPER. >>c:\eft\ncrpos%pointer%.ini
echo.Res-009=..................... >>c:\eft\ncrpos%pointer%.ini
echo.Res-010=CREDIT >>c:\eft\ncrpos%pointer%.ini
echo.Res-011=Ok >>c:\eft\ncrpos%pointer%.ini
echo.Res-012=Cancel >>c:\eft\ncrpos%pointer%.ini
echo.Res-013=Payment >>c:\eft\ncrpos%pointer%.ini
echo.Res-014=Void >>c:\eft\ncrpos%pointer%.ini
echo.Res-015=Customer Identification >>c:\eft\ncrpos%pointer%.ini
echo.Res-016=Waiting for card data... >>c:\eft\ncrpos%pointer%.ini
echo.Res-017=Processing Card... >>c:\eft\ncrpos%pointer%.ini
echo.Res-018=Insert PIN: >>c:\eft\ncrpos%pointer%.ini
echo.Res-019=Refund >>c:\eft\ncrpos%pointer%.ini
echo.Res-020=Withdraw >>c:\eft\ncrpos%pointer%.ini
echo.Res-021=EFT: Options >>c:\eft\ncrpos%pointer%.ini
echo.Res-022=Select a marked option: >>c:\eft\ncrpos%pointer%.ini
echo.Res-023=Continue >>c:\eft\ncrpos%pointer%.ini
echo.Res-024= >>c:\eft\ncrpos%pointer%.ini
echo.Res-025=Insert your card... >>c:\eft\ncrpos%pointer%.ini
echo.Res-026=Insert PIN... >>c:\eft\ncrpos%pointer%.ini
echo.Res-027=Insert Card Data >>c:\eft\ncrpos%pointer%.ini
echo.Res-028=PAN >>c:\eft\ncrpos%pointer%.ini
echo.Res-029=Exp. Date (YYMM) >>c:\eft\ncrpos%pointer%.ini
echo.Res-030=Welcome To\nKFC >>c:\eft\ncrpos%pointer%.ini
echo.Res-031=processing data... >>c:\eft\ncrpos%pointer%.ini
echo.Res-032=Insert your card >>c:\eft\ncrpos%pointer%.ini
echo.Res-033=Insert PIN: >>c:\eft\ncrpos%pointer%.ini
echo.Res-034=Insert Supervisor Data >>c:\eft\ncrpos%pointer%.ini
echo.Res-035=Retailer Code: >>c:\eft\ncrpos%pointer%.ini
echo.Res-036=Store Code: >>c:\eft\ncrpos%pointer%.ini
echo.Res-037=Initialising Hardware... >>c:\eft\ncrpos%pointer%.ini
echo.Res-038=Ending Transaction to >>c:\eft\ncrpos%pointer%.ini
echo.Res-039=waiting for server ACK >>c:\eft\ncrpos%pointer%.ini
echo.Res-040=Ping >>c:\eft\ncrpos%pointer%.ini
echo.Res-041=Waiting for server answer... >>c:\eft\ncrpos%pointer%.ini
echo.Res-042=Executing Pinpad Init.... >>c:\eft\ncrpos%pointer%.ini
echo.Res-043=Selected Pinpad >>c:\eft\ncrpos%pointer%.ini
echo.Res-044=Remove Card >>c:\eft\ncrpos%pointer%.ini
echo.Res-045=PLEASE REMOVE CARD >>c:\eft\ncrpos%pointer%.ini
echo.Res-046=Card not enabled >>c:\eft\ncrpos%pointer%.ini
echo.Res-047=Start Date >>c:\eft\ncrpos%pointer%.ini
echo.Res-048=Issue Number >>c:\eft\ncrpos%pointer%.ini
echo.Res-049=Del. >>c:\eft\ncrpos%pointer%.ini
echo.Res-050=Next >>c:\eft\ncrpos%pointer%.ini
echo.Res-051=Give Customer Cashback Amount >>c:\eft\ncrpos%pointer%.ini
echo.Res-052=Input String >>c:\eft\ncrpos%pointer%.ini
echo.Res-053=APPROVED >>c:\eft\ncrpos%pointer%.ini
echo.Res-054=Selecting Option >>c:\eft\ncrpos%pointer%.ini
echo.Res-055=Selecting Card's Application >>c:\eft\ncrpos%pointer%.ini
echo.Res-056=try again >>c:\eft\ncrpos%pointer%.ini
echo.Res-057=Cashback Entry >>c:\eft\ncrpos%pointer%.ini
echo.Res-058=Insert String >>c:\eft\ncrpos%pointer%.ini
echo.Res-059=Value >>c:\eft\ncrpos%pointer%.ini
echo.Res-060=Cashback >>c:\eft\ncrpos%pointer%.ini
echo.Res-061=Amount >>c:\eft\ncrpos%pointer%.ini
echo.Res-062=Insert Referral Code >>c:\eft\ncrpos%pointer%.ini
echo.Res-063=Code >>c:\eft\ncrpos%pointer%.ini
echo.Res-064=Cashback Required?\nNo (CNL) Yes(ENT) >>c:\eft\ncrpos%pointer%.ini
echo.Res-065=Choose Amount: F1-F3 >>c:\eft\ncrpos%pointer%.ini
echo.Res-066=No Card Data Collected\nSwipe Again >>c:\eft\ncrpos%pointer%.ini
echo. >>c:\eft\ncrpos%pointer%.ini
echo.[NCRPOS_RES_ Descriptions] >>c:\eft\ncrpos%pointer%.ini
echo.res-FE=TRANX CANCELLED >>c:\eft\ncrpos%pointer%.ini
echo.res-FD=NCRPOS_RES_ERR_INTERNAL >>c:\eft\ncrpos%pointer%.ini
echo.res-FC=NCRPOS_RES_ERR_TIMEOUT >>c:\eft\ncrpos%pointer%.ini
echo.res-FB=NCRPOS_RES_ERR_TOUTTALLY >>c:\eft\ncrpos%pointer%.ini
echo.res-FA=NCRPOS_RES_ERR_BADAMOUNT >>c:\eft\ncrpos%pointer%.ini
echo.res-F9=NCRPOS_RES_ERR_UNEXPMSG >>c:\eft\ncrpos%pointer%.ini
echo.res-F8=NCRPOS_RES_ERR_TALLY >>c:\eft\ncrpos%pointer%.ini
echo.res-F7=NCRPOS_RES_ERR_INVALIDHANDLE >>c:\eft\ncrpos%pointer%.ini
echo.res-F6=NCRPOS_RES_ERR_OUTOFSEQUENCE >>c:\eft\ncrpos%pointer%.ini
echo.res-F5=NCRPOS_RES_ERR_NODATA >>c:\eft\ncrpos%pointer%.ini
echo.res-F4=NCRPOS_RES_ERR_BADTID >>c:\eft\ncrpos%pointer%.ini
echo.res-F3=NCRPOS_RES_ERR_BUSY >>c:\eft\ncrpos%pointer%.ini
echo.res-F2=PLEASE SWIPE CARD >>c:\eft\ncrpos%pointer%.ini
echo.res-F1=NCRPOS_RES_ERR_DISCONNECTED >>c:\eft\ncrpos%pointer%.ini
echo.res-F0=NCRPOS_RES_ERR_NOTSUPPORTED >>c:\eft\ncrpos%pointer%.ini
echo.res-EF=NCRPOS_RES_ERR_LOCK >>c:\eft\ncrpos%pointer%.ini
echo.res-EE=NCRPOS_RES_ERR_BADINCOMINGDATA >>c:\eft\ncrpos%pointer%.ini
echo. >>c:\eft\ncrpos%pointer%.ini



set /a pointer += 1


if /i %pointer% NEQ %count% goto loop
goto copy%count%




:end

echo. All Done

pause
 
Ouch! Glad you got a solution.

I was gonna try and create an updated batch, but to be honest I really couldn't follow your file. I leave adding in the details to you. Here is an updated version, and has no limit to the number of nodes, either.


Code:
@echo off


SETLOCAL ENABLEDELAYEDEXPANSION

ECHO.
SET /P IPADDRESS="             ENTER IP:"
SET /P NODE="ENTER NUMBER OF NODES:"


ECHO.
ECHO NUMBER OF COMPUTERS IS %NODE%
ECHO IP ADDRESS IS %IPADDRESS%
ECHO.

FOR /L %%G IN (1,1,%NODE%) DO (

REM INSERT ALL THE STUFF YOU WANT IN EACH FILE HERE, I.E THE ECHO STATEMENTS
REM %%G IS THE NODE NUMBER AND INCREMENTS EACH LOOP UNTIL IT HITS NODE, AS ENTERED BY THE USER
REM %IPADDRESS% IS THE IP ADDRESS AS ENTERED BY THE USER

	ECHO PROCESSING NODE=%%G, IPADDRESS=%IPADDRESS%
	
)

currently it just loops for each node and displays the values. add your own details in as needed.
 
Last edited:
nice.

That would have been better, but i ended up with god knows how many loops, twists and turns!!

cheers for the help. (Boss is well happy) :D

blastman
 
Back
Top Bottom