Reading Each Line Of A Text File
Posted: 02 Sep 2011 16:48
Hello everyone, a friend of mine requested that I create a batch script for him that will transform a text file, full of names, into a series of folders with those same names. I know how to do this but I need help with the very first part. Reading from the text file.
This is what I have so far for this fuction:
Then I would use the variables to create the dirs I need. But for some reason I get an error:
(EDIT) I fixed the error because I was using cmd to run the code. Changed %% to % and that got rid of the first problem. Sorry about that, but now there is this one.
For the record I have no experence with using the 'for' command or any of its functions. Mostly because I havent really been able to find someone to help me with it. It is kind of confusing to me. Anyways I also need the delimiter for a carrage return if anyone knows it. I could also do this in vbs but I would like to try this first.
Thx in advance
-Phill
This is what I have so far for this fuction:
Code: Select all
for /f "delims=(code for return...)" %%a in Names.txt do set n1=%%b & set n2=%%c
Then I would use the variables to create the dirs I need. But for some reason I get an error:
(EDIT) I fixed the error because I was using cmd to run the code. Changed %% to % and that got rid of the first problem. Sorry about that, but now there is this one.
Code: Select all
Names.txt was unexpected at this time.
For the record I have no experence with using the 'for' command or any of its functions. Mostly because I havent really been able to find someone to help me with it. It is kind of confusing to me. Anyways I also need the delimiter for a carrage return if anyone knows it. I could also do this in vbs but I would like to try this first.
Thx in advance
-Phill