Echoing to a file results in spaces in Batch
Using a batch file (.bat), I'm making a script that requires dynamic paths
so that it can work on multiple computers. My problem is when I echo
something to a file, it adds a line and an a return carriage.
Say I have a text file named foo.txt in the directory of the batch file,
and its contents are completely empty.
In the batch file, I run:
echo test > foo.txt
The contents of foo.txt will be:
L1:foo
L2: There would be a space after foo in the first line and a second empty
line. Now, this would be completely okay and I would entirely ignore it,
but filename paths do not ignore it.
importing text from foo.txt like so:
set /p foo=< foo.txt
...and then:
set /p name=< C:\A.D.V.E.N.T.U.R.E.\test\%foo%\test2.txt
...would be interpreted as:
set /p name=< C:\A.D.V.E.N.T.U.R.E.\test\foo \test2.txt
Including an unwanted space. Is there anyway to make it so you can write
text to a file without a space, or a command one could use to delete the
carriage return and the space?