I've recently taken up Batch just as a hobby, so I'm still fairly new to all this. Currently, I've made a simple program that allows you to create a password with the input of a master key, and allows it to store it into a document that will be hidden to sight. Now, I was wondering if you could make it so that, in a text document, you can put a topic down, and then make the file put whatever you input into the program sort it through each topic.
So, say I have a topic called emails, and I have my program ask me "Which topic would you like to put this password under?" I would input emails, and then it would ask "What account would you like to put this password under?" I input Gmail, and then it asks for the password, then writes the password as Gmail- (password) inside the document. Is this possible? Or do I have to code in each and every single different variable that it could be as, such as
Code: Select all
set /p topic= What topic will this file under?
if %topic%==email goto email
:email
set /p email= What email will this file under?
if %topic%==gmail goto gmail
if %topic%==aol goto aol
sidenote, code looks like this so far:
Code: Select all
@echo off
:start
cls
echo 1.) Create Password
echo 2.) Check Password
echo 3.) Open Passwords Document
echo.
set /p program= What do you want to do?
if %program%== create goto security
if %program%== check goto check
if %program%== open passwords document goto security2
if %program%== open goto security2
if %program%== open passwords document goto security2
if %program%== passwords goto security2
if %program%== 1 goto security
if %program%== 2 goto check
if %program%== 3 goto security2
:security
cls
set /p masterkey= Please enter the master key:
if %masterkey%== testingkey goto create
pause>nul
:security2
cls
set /p masterkey2= Please enter the master key:
if %masterkey2%== testingkey2 start random.txt
pause>nul
:create
cls
set /p password= What would you like your password to be?
echo %password% >> random.txt
pause
goto start
:check
cls
set /p password1=What is your password?
for /f "Delims=" %%a in (random.txt) do (
set TEXT=%%a
)
if %password1%==%text% goto correct
echo Incorrect password.
pause>nul
goto start
:correct
echo Correct password.
set /p open=Select "o" to open the document of passwords, or select "n" to return to the menu.
if %open%==o goto pass
if %open%==n goto start
pause>nul
:pass
start random.txt