mardi 8 septembre 2015

Bath file simple test

Okay, so I've got a batch file going here, I've been playing with asking questions, then doing a task based on the answer. The following runs(because in the example, WinVer DOES equal Win10), however it ignores whether I press y, Y, n or N and continues the script outside the if statement.

I'm hoping someone can tell me why!

if %WinVer%==Win10 (
set /p RUNTEST="Run Test? (Y or N): "
if '%RUNTEST%' EQU 'y' ECHO This is a test!
if '%RUNTEST%' EQU 'Y' ECHO This is a test!
if '%RUNTEST%' EQU 'n' timeout 1 >nul 2>&1
if '%RUNTEST%' EQU 'N' timeout 1 >nul 2>&1
)

(I put the "Run Test" in quotations because it contains brackets, and apparently breaks everything if you don't)

Aucun commentaire:

Enregistrer un commentaire