I am developing a program in batch that will play the board game Talisman (second edition). It is in very early development and not ready for testing.
At one point in the code I need to print the top line of a text document. This part of the code looks like this:
find /I "alchemy" priorities.txt >nul
if %errorlevel%==0 (
set /p alchemObj=< 2Alchemise.txt
echo I will visit the alchemist in the city.
echo.
echo The Alchemist converted my %alchemObj% into 1 gold
set /a gold=%gold%+1
echo I now have %gold% gold.
for /f "skip=1 delims=*" %%a in (2Alchemise.txt) do (
echo %%a >>newfile.txt
)
xcopy newfile.txt 2Alchemise.txt /y >nul
del newfile.txt /f /q >nul
)
When this program is run everything except the
echo The Alchemist converted my %alchemObj% into 1 gold
seems to work. When it is run it prints "The Alchemist converted my into 1 gold"
I have tried running:
set /p alchemObj=< 2Alchemise.txt
and then
echo The Alchemist converted my %alchemObj% into 1 gold
and it seems to work just as expected.
Thanks for your help, Edje