Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I need to set the first line of a *.ini file to a variable and then delete it, and then look at the new first line set it and then delete it until there are no lines left. For example
test.ini
2
60
"C:\documents and settings\me\desktop\p.txt"
40
"C:\documents and settings\me\desktop\q.txt"I would like to be able to set each line to its own variable but the only way I can think to do it is to delete each line after it is read in. I have looked at some examples of ways to read through a list but I was completely lost. Any help either with code to read through the list or delete each element is much appreciated.
Thanks

@echo off
setLocal EnableDelayedExpansionfor /f "tokens=* delims= " %%a in (my.ini) do (
set /a N+=1
set var!N!=%%a
)
set v
=====================================
If at first you don't succeed, you're about average.M2

Thanks so much that worked great but now i have another question.
In the ini i have two groups of info2
60
c:\...
/min45
c:\documents and settings\...
/maxThe first line "2" tells the program how many groups there are. I am trying to figure out a way to get the first line and then use that to gather all the other information into variables. The problem is that i don't want to have to type out code or ever group, for example both lines that start with c:\ are applications that need to be started. I would like some way of saying start var2,var4,var6...varn+2 up until said var does not exist. Sorry is this is a confusing question again thanks for any help.

Hi tony,
It shows all vars beginning with v. In this case, just to show that it worked.
==================================
Nath5,
Do you want to run every line whoch contains:
"C:\documents and settings\me...
=====================================
If at first you don't succeed, you're about average.M2

![]() |
C Get single Char
|
visual studio 2005
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |