1.

Solve : How can I count the restart cycle in a batch file??

Answer»

I would like to run a batch file which does a sequence of operations and then restarts the PC. This is one restart cycle. I hope to do the restart cycle 100 times. How can I count the restart cycles? Thanks.You have to create a file with a number in it. Start with zero.
Just after the reset open the file and INCREMENT the number my one.
When the number ion the file is equal to 100, stop the cycle.

I would suggest you test it first with a smaller number.just to see how it works.
Ya, that is what I figured to do. But it expands to several issues which I don't KNOW how to do it in DOS Command:
1. How to read a file content?
2. How to increase it number string?
3. How to check if the string is equal to 100?
Could you help me?1. How to read a file content?

Assuming the file contains just a number.

for /f "delims=" %%a in ('type "file.txt" ' ) do SET num=%%a

2. How to increase it number string?

set /a num=num + 1
>"file.txt" echo %num%


3. How to check if the string is equal to 100?

if %num% EQU 100 echo I'm finished!I verified it. Thanks a lot.
BTW, how can I read user input from keyboard into a VARIABLE? Thanks.Code: [Select]set "var="
set /p "var=Enter your reply: "
echo "%var%"Thanks.



Discussion

No Comment Found