Edit: I did not realize you had to use escapes within echo
commands. After looking at the linked duplicate answer and the answers to this question, I have fixed my issue by using escapes on the >
and |
. I also implemented @Mofi's suggestion which was to remove the ==
from the ERRORLEVEL
statements. Thank you all so much for your suggestions and advice! The corrected code is:
@ECHO OFF
ECHO ====================================================
ECHO \ _______ __ __ /
ECHO / /_ __(_)_ _ ___ / //_/__ ___ ___ ___ ____ \
ECHO \ / / / / ' \/ -_) ,^< / -_) -_) _ \/ -_) __/ /
ECHO / /_/ /_/_/_/_/\__/_/^|_^|\__/\__/ .__/\__/_/ \
ECHO \ /_/ /
ECHO / Choose an Option: \
ECHO \ Clock [I]n /
ECHO / Clock [O]ut \
ECHO \ [S]ee Previous Times /
ECHO / \
ECHO \ /
ECHO / \
ECHO \ /
ECHO / \
ECHO ====================================================/
CHOICE /c IOS /N
IF ERRORLEVEL 3 goto :Times
IF ERRORLEVEL 2 goto :Out
IF ERRORLEVEL 1 goto :In
Original Question:
I'm making a file called "TimeKeeper" and I wanted it to look cool so I had it print timekeeper in ASCII art style. But every time I run the script is errors out after echoing the first four lines and says:
Access is denied.
'_' is not recognized as an internal or external command, operable program or batch file.
The thing that confuses me is I'm using echo to output the ASCII and it seems to be formatted properly. I'm encoding in ANSII and have no other encoding formats in the file
Code:
@ECHO OFF
ECHO ====================================================
ECHO \ _______ __ __ /
ECHO / /_ __(_)_ _ ___ / //_/__ ___ ___ ___ ____ \
ECHO \ / / / / ' \/ -_) ,< / -_) -_) _ \/ -_) __/ /
ECHO / /_/ /_/_/_/_/\__/_/|_|\__/\__/ .__/\__/_/ \
ECHO \ /_/ /
ECHO / Choose an Option: \
ECHO \ Clock [I]n /
ECHO / Clock [O]ut \
ECHO \ [S]ee Previous Times /
ECHO / \
ECHO \ /
ECHO / \
ECHO \ /
ECHO / \
ECHO ====================================================
CHOICE /c IOS /N
IF ERRORLEVEL == 3 goto :Times
IF ERRORLEVEL == 2 goto :Out
IF ERRORLEVEL == 1 goto :In
It doesn't even get to the choice prompt before it closes due to the error. This basically halts the entire program so I'm stuck, any advice or suggestions helps a ton!