Where did I go wrong [Batch]?

What is wrong with this code? I have it open this program:

@echo off
mode 18,4
title Actions
:1
cls
echo (B)           (Y)
echo   (A)       (X)
echo.
set /p a=
echo %a%> link.txt
goto 1

And this prgram is supposed to read the input. Basically, the first one sends a message to a TXT file. Then this program picks up the message from the TXT file and turns it into a variable.

@echo off
title Whack-a-Mole
set a=10
set mole=0
set time=0
set timeend=0
:Start
cls
set /a a=%a%-1
echo This game uses the "Actions" gamepad unit.
echo.
echo.
echo Hit the most moles to win!
echo.
echo Game starts in %a% seconds.
ping localhost -n 2 > nul
if %a% equ 0 goto Game
goto Start
:Game
if exist Actions.bat start Actions.bat
cls
echo Press "A" on the gamepad unit to swing your bat. Press "B" to stop.
echo.
if not exist link.txt (
echo The file "link.txt" could not be found. This game cannot be played without it.
ping localhost -n 4 > nul
)
if not exist Actions.bat (
echo The file "Actions.bat" could not be found. This game cannot be played without it.
ping localhost -n 4 > nul
)
ping localhost -n 4 > nul
:GameBegin
cls
echo Ready...
ping localhost -n 4 > nul
cls
echo GO!
ping localhost -n 2 > nul
:Mole1
cls
set /a time=%random%/7000
echo Reaction Time:%timeend%
echo Moles Hit:%mole%
echo.
echo [__][__][__][__]
echo   [__][__][__][__]
echo     [__][__][__][__]
ping localhost -n 2 > nul
set a=< link.txt
echo 00> link.txt
if /i "%a%"=="a" goto gameover
if /i "%a%"=="b" goto gameover
if /i "%a%"=="00" goto gameover
set a=
ping localhost -n %time% > nul
goto Mole2
:Mole2
cls
set /a time=%random%/7000
echo Reaction Time:%timeend%
echo Moles Hit:%mole%
echo.
echo [__][__((O.O))_]
echo   [__][__/:_][__]
echo     [__][/ [__][__]
ping localhost -n 2 > nul
set a=< link.txt
echo 00> link.txt
if /i "%a%"=="a" (
set /a mole=%mole%+1
goto Time
)
if /i "%a%"=="b" goto gameover
if /i "%a%"=="00" goto gameover
set a=
ping localhost -n %time% > nul
goto gameover
:Time
set timestart=%time:~2%
set timeend=%timestart:~4,2%
if /i %timeend% equ 01 set timeend=1
if /i %timeend% equ 02 set timeend=2
if /i %timeend% equ 03 set timeend=3
if /i %timeend% equ 04 set timeend=4
if /i %timeend% equ 05 set timeend=5
if /i %timeend% equ 06 set timeend=6
if /i %timeend% equ 07 set timeend=7
if /i %timeend% equ 08 set timeend=8
if /i %timeend% equ 09 set timeend=9
set /a timeend= %timeend%+2+%random:~1,1%
if %timeend% geq 60 (
goto gameover
)
goto Mole1
:gameover
cls
echo You got %mole% moles.
echo Your fastest time was %timeend%.
echo.
echo Type in "B" on the gamepad unit to go back to the main menu.
:input
set a=< link.txt
if /i "%a%"=="b" goto Start
goto input

It may look kinda wierd here, but that's because of instructables, not me. Anyways, it goes through the animations and doesn't even notice that there are any IF commands. Where did I go wrong?

EDIT: Figured it out. Corrected:

SET /P a=< link.txt

Forgot the /p!

Chad Baxter5 years ago
try not to use parentheses or quotation marks as the code parser will view these as code and wont display them. use notepad++ an open source program to help you... if, in echoed text you see symbols that are highlighted red change them. notepadd++ highlights these characters to tell you that you are setting booleans... which you arent. hope it helps...