Im trying to write a batch file that allows the user to select a font based off an array of valid names. These are some requirements for how i would like it to work;
- user enters the name of the font (case sensitive and with spaces and typed without quotation marks)
- batch file checks an array or list to see if what was entered is a valid font name, if its not go back to step 1, if its valid move on
- output that valid font name to a variable that i can use later (the font name needs to be case sensitive and have spaces)
This is what i have so far;
@echo off
set validFonts=Arial,Arial Italic,Arial Bold,Arial Bold Italic
:fontB
set /p fontName=Enter Desired Font Name:
(for %%a in (%validFonts%) do (
if %fontName% == %%a goto:fontG
))
echo "Invalid Font Name"
goto :fontB
:fontG
echo.
pause
It works when you enter Arial
for the font name but closes the window like a crash when entering Arial Italic
Any help would be really apreciated as im really pretty new to making batch files.