I am not getting the desired results, and I'm not sure what I'm doing wrong with this simple code. Hopefully it's clear what I'm trying to do. I did reading on the subject but failed and have wasted enough time so I am hoping an expert can help.
This is to run on Server 2008 R2.
choice /C 123456780 /N /M "Type a number or close the window to cancel:"
if ERRORLEVEL 9 (
if ERRORLEVEL 8 (
It continues 9 through 1, but doesn't match so goes to :end
I also tried a block of
if errorlevel 1 goto 1
if errorlevel 2 goto 2
What I found is that I can echo %errorlevel% and get the proper value returned from choice, but if I try to do anything else it becomes null or 0, not sure.