@echo off
for /f %%a in (httpd.conf) do (
echo %%a
)
I have a file that looks like this:
ServerRoot "C:/xampp/apache"
Listen 80
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
however when i run the batch file, it outputs this:
ServerRoot
Listen
LoadModule
LoadModule
it appears that cmd is only fetching the line UP TO the first space character… Does anybody know how to get the whole line?
I’ve tried adding options to the for command… these have been tried and these all fail:
for /f "eol=# tokens=1-9 delims=¬"
for /f "tokens=* delims=¬"
for /f "tokens=* delims=:\="
for /f "tokens=1-6"
Add “delims=” to your command in order for it to process lines which include spaces in them. So, your code should look a bit like this:
Also you can add more delimiters to your list like commas, etc. To do that you just add the characters to the “delims =,+”