Skip to content

Instantly share code, notes, and snippets.

@jcefoli
Created August 15, 2014 22:33
Show Gist options
  • Save jcefoli/fb9400aafee2ac585db3 to your computer and use it in GitHub Desktop.
Save jcefoli/fb9400aafee2ac585db3 to your computer and use it in GitHub Desktop.
Template for Yes/No Choice input in batch files
@ECHO OFF
:start
SET choice=
SET /p choice=Do something? [N]:
IF NOT '%choice%'=='' SET choice=%choice:~0,1%
IF '%choice%'=='Y' GOTO yes
IF '%choice%'=='y' GOTO yes
IF '%choice%'=='N' GOTO no
IF '%choice%'=='n' GOTO no
IF '%choice%'=='' GOTO no
ECHO "%choice%" is not valid
ECHO.
GOTO start
:no
ECHO Do all of the no things here!
PAUSE
EXIT
:yes
ECHO Do all of the yes things here!
PAUSE
EXIT
@ChristineRos
Copy link

ChristineRos commented Jul 13, 2024

This batch file handles Yes/No inputs and performs actions based on the user's choice. It uses case-insensitive checks for "Y" or "N" and defaults to "No" if no input is given. Looks solid! I was working on an essay about victimology and found a highly informative sample on https://www.topessaywriting.org/samples/victim This sample delved into the different types of victimization, the psychological effects on victims, and the societal response to victims. The paper was well-researched and presented in a clear and structured manner. It provided me with valuable insights and a better understanding of the subject, which significantly improved the quality of my essay. This is an excellent resource for anyone exploring the topic of victimology.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment