Help with MS DOS

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
atueerd2
Posts: 1
Joined: 27 Oct 2012 18:39

Help with MS DOS

#1 Post by atueerd2 » 27 Oct 2012 18:43

Okay, please help me out. I'm making my own programming language (as a joke) and something isn't working. Here's the code I have so far(or at least part of it...):

Code: Select all

:proj
::START MAIN
echo [
::line1
set /p line1= }}
(
ECHO %line1%
) >title.txt
::line2
::add all basic combos!
set /p line2=    }}
set line2="%line2%"   
If %line2%==black on white (
ECHO color f0
) >colorings.txt
If %line2%==white on black (
ECHO color 0f
) >colorings.txt
If %line2%==black on blue (
ECHO color 10
) >colorings.txt
If %line2%==blue on black (
ECHO color 01
) >colorings.txt
If %line2%==green on black (
ECHO color 0a
) >colorings.txt
If %line2%==black on green (
ECHO color a0
) >colorings.txt
::line3
set /p line2=    }}
if %line2%= close
   echo ]
goto end

:end                                                               
pause>nul
goto end


When I run this it shows all the colors (color a1, color a2, etc.) and does nt create colorings.txt. HELP!

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Help with MS DOS

#2 Post by foxidrive » 27 Oct 2012 19:57

This will generate an error or expect a command called ON

If %line2%==black on green

Adding quotes allows you to compare a full term with spaces etc.


If "%line2%"=="black on green"

Post Reply