New
#1
Batch File To Loop Menu
I'm creating a batch file that will launch when I login to my user account. I followed this tutorial to create a batch file with a menu. It works, however, if the user enters a number that is not listed, I want it to go back to the menu. How would I implement that?
Side note: I understand I could use something more flexible like Powershell, however, I prefer batch files.
Here is what I have so far:
Code:@ECHO OFF CLS :MENU echo Welcome %USERNAME% echo 1 - Start KeePass echo 2 - Backup echo 3 - Exit SET /P M=Type 1,2,3 then press Enter: IF %M%==1 GOTO StarKeePass IF %M%==2 GOTO Backup IF %M%==3 GOTO EOF :StarKeePass SET keePass="%USERPROFILE%\KeePass\KeePass-2.30\KeePass.exe" SET kdb="%USERPROFILE%\KeePass\PasswordDatabase\PasswordDatabase.kdbx" echo I'll start KeePass for You START "" %keePass% %kdb% GOTO MENU :Backup SET backup="%USERPROFILE%\backup.bat" call %backup% GOTO MENU