1.

Solve : A counter in DOS?

Answer»

I use Windows 98

This is the script WRITTEN by me..
I did edit the autoexec.bat too..
My only problem is that i want a counter to count how many times my system reboot.

@echo off
echo Counter >>mylog1.txt
grep Counter C:\mylog1.txt -N -T -Q >>mylog.txt
IF NOT EXIST File1 md File1 >NUL
IF NOT EXIST C:\File1\*.ROM copy C:\BIOS\P12N0027.ROM File1 /I
IF NOT EXIST File2 md File2 >NUL
IF NOT EXIST C:\File2\*.ROM copy C:\BIOS\P13N0028.ROM File2 /I
IF NOT EXIST new md new >NUL
echo Rotate the Files >>mylog.txt
move C:\File1\*.* C:\new >>mylog.txt
move C:\File2\*.* C:\File1 >>mylog.txt
move C:\new\*.* C:\File2 >>mylog.txt
CHOICE /ty, 10 |pause >NUL
echo g=ffff:0000 | debug

as you can see, i'm using grep to count how many the word "counter" appear in the mylog1.txt. this is not really suitable.

let's say the system rebooting for 32 times then i hit Ctrl+C.. Next time when i boot the system i want the system counter to be started from 0.

please help me..
i've tried many ways@echo off
echo Counter >>mylog.txt
SET count=0
FOR /f %%L IN (mylog.txt) DO (call set /a count=%count%+1)
echo Counter=%count%

whenever i ran this script the answer always Counter=1..
REGARDLESS how many word counter appear in mylog.txt.

please..
is there anything i miss out?
i use DOS Microsoft Windows 98 (version 4.10.2222)Double the percent sign in the call statement like:

FOR /f %%L IN (mylog.txt) DO (call set /a count=[highlight]%%[/highlight]count[highlight]%%[/highlight]+1)

DOS IT HELP?THANKS DosItHelp...
it really works...

thanks alot FYI

i tried this out at WIN98 (4.10.2222)... and its not working

so, i used

@echo off
echo Counter >>Counter
find /c "Counter" Counter >>mylog.txt
echo Executed

then i think it should be ok...



Discussion

No Comment Found