So I have a file with multiple lines of letters and numbers as shown:
a
1
h
7
G
k
3
l
END
I need a type of code that combines them together and preferably outputs it into a variable as shown:
var=a1h7Gk2l
Any help would be appreciated.
@echo off
setlocal enableDelayedExpansion
set "var="
for /f "usebackq" %%A in ("test.txt") do set var=!var!%%A
echo !var!
Edit
I assumed "END" does not physically exist in your file. If it does exist, then you can add the following line after the FOR statement to strip off the last 3 characters.
set "!var!=!var:~0,-3!"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With