Hi,
I have an txt File that contains a single line of text, and I want to load the txt string from the TXT file into a DOS Batch variable then Concat the string to the section of the string that I need.
Filename: InvoiceNumber.txt
I have no idea where to start, could someone please help.
Thanks,
Rimal 7
DOS Batch Newbie
Loading a Single Line of a txt files into a Variable
Moderator: DosItHelp
Rimal7,
To get the string from the file use the "for /f" command.
DosItHelp?
To get the string from the file use the "for /f" command.
Code: Select all
REM The "for /f" command reads a line from a file
for /f "delims=" %%a in (InvoiceNumber.txt) do set "TxtFromFile=%%a"
REM Now concatenate as desired
set "txt=Hi, this is from the InvoiceNumber.txt file: %TxtFromFile%"
echo.%txt%
DosItHelp?
Loading from a TXT file
Worked Beautifully
Thanks for your help,
Rimal 7
Thanks for your help,
Rimal 7