Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
rasil
- Posts: 31
- Joined: 23 Apr 2020 13:05
#1
Post
by rasil » 12 Dec 2020 13:45
Hi!,
I am having some problems loading a txt file line by line and then being able to save all that information into a variable. i have tried this
Code: Select all
FOR /F %%i IN (log.txt) DO ECHO %%i
but it only displays text before an space. The text inside log.txt has spaces so i would like to desplay the full length of text.
Rasil
-
aGerman
- Expert
- Posts: 4678
- Joined: 22 Jan 2010 18:01
- Location: Germany
#2
Post
by aGerman » 12 Dec 2020 15:18
Default delimiters are space and tab as discribed in the help text of FOR.
Code: Select all
FOR /F "delims=" %%i IN (log.txt) DO ECHO %%i
However, blank lines are still skipped. Lines beginning with a semicolon, too.
What about ...
Steffen
-
rasil
- Posts: 31
- Joined: 23 Apr 2020 13:05
#3
Post
by rasil » 12 Dec 2020 17:33
Worked perfectly thanks Steffen!