Computer Hope

Microsoft => Microsoft Windows => Windows 8 => Topic started by: lolhelpme on July 10, 2018, 07:07:08 AM

Title: help me correct the code!
Post by: lolhelpme on July 10, 2018, 07:07:08 AM
so, lately i had an idea to make a program that will store the password in a txt file and other programs would read and use it
here is the code to a program that will generate the password:

@echo off
title S.A.F.E setup
color 0a
ver
echo S.A.F.E PROTOCOL INITIATED
break> %userprofile%\documents\psscod.txt
PAUSE
:setup
set password=%random%
@echo %password%> %userprofile%\documents\psscod.txt
echo this is your S.A.F.E password: %password%
set /p passcode= please repeat password.
If %passcode%==%password% goto t
If NOT %passcode%==%password% goto n
:t
echo setup completed succesfully.
pause
exit
:n
echo error incorrect password!
echo resetting protocol..
pause
goto setup

and here is the code to implement it to other programs but it doesn't work:

@echo off
echo enter S.A.F.E password
for /f "delims=" %%v in (%userprofile%\documents\psscod.txt) do set var=%%v&goto next
:next
set /p passcode=>
If %passcode%==%v% goto t
If NOT %passcode%==%v% goto n
:t
echo password correct
goto program
:n
echo password incorrect!
pause
exit
:program
echo yay!
pause

can you just help me and correct the second piece of the code?