hey guys
i was just wondering if its possible to set multiple lines into one variable
if it is please tell me if not tell me anyway
can you set multiple lines into one variable?
Moderator: DosItHelp
Re: can you set multiple lines into one variable?
It's possible and you will find a few examples in this forum.
Regards
aGerman
Code: Select all
@echo off
:: Create LineFeed character ::::::::::::::
set lf=^
:: Two empty lines above are neccessary! ::
set "line1=Hello"
set "line2=World!"
setlocal enabledelayedexpansion
:: merge both variables
set "var=!line1!!lf!!line2!"
:: display the result
echo !var!
endlocal
pause
Regards
aGerman
Re: can you set multiple lines into one variable?
Thanks alot that realy helps
-=BatMaster=-
-=BatMaster=-
Re: can you set multiple lines into one variable?
aGerman,
What are the "!!" for?
Rileyh
What are the "!!" for?
Rileyh
Re: can you set multiple lines into one variable?
The ! replaces the % for environment variables if enabledelaiedexpansion was set and you have to expand this variable more than once in a command line or a block.
Regards
aGerman
Regards
aGerman