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;
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.
I found what I was doing wrong, I needed quotes around my array strings AND when i called that array;
set validFonts="Arial","Arial Italic","Arial Bold","Arial Bold Italic"
:fontB
set /p fontName=Enter Desired Font Name:
(for %%a in (%validFonts%) do (
if /i "%fontName%" == %%a goto:fontG
))
echo "Invalid Font Name"
goto :fontB