

InterviewSolution
Saved Bookmarks
1. |
Solve : help me correct the code!? |
Answer» <html><body><p>so, lately i had an idea to <a href="https://interviewquestions.tuteehub.com/tag/make-249948" style="font-weight:bold;" target="_blank" title="Click to know more about MAKE">MAKE</a> a program that will <a href="https://interviewquestions.tuteehub.com/tag/store-653508" style="font-weight:bold;" target="_blank" title="Click to know more about STORE">STORE</a> the password in a txt file and other programs would read and use it<br/>here is the code to a program that will generate the password:<br/><br/>echo off<br/>title S.A.F.E setup<br/>color 0a<br/>ver<br/>echo S.A.F.E PROTOCOL INITIATED<br/>break> %userprofile%\documents\psscod.txt<br/>PAUSE<br/>:setup<br/>set password=%random%<br/>echo %password%> %userprofile%\documents\psscod.txt<br/>echo this is your S.A.F.E password: %password%<br/>set /<a href="https://interviewquestions.tuteehub.com/tag/p-236832" style="font-weight:bold;" target="_blank" title="Click to know more about P">P</a> passcode= please repeat password.<br/>If %passcode%==%password% goto t<br/>If NOT %passcode%==%password% goto <a href="https://interviewquestions.tuteehub.com/tag/n-236724" style="font-weight:bold;" target="_blank" title="Click to know more about N">N</a><br/>:t<br/>echo setup completed succesfully.<br/>pause<br/>exit<br/>:n<br/>echo error <a href="https://interviewquestions.tuteehub.com/tag/incorrect-499101" style="font-weight:bold;" target="_blank" title="Click to know more about INCORRECT">INCORRECT</a> password!<br/>echo resetting protocol..<br/>pause<br/>goto setup<br/><br/>and here is the code to implement it to other programs but it doesn't work:<br/><br/>echo off<br/>echo enter S.A.F.E password<br/>for /f "delims=" %%v in (%userprofile%\documents\psscod.txt) do set var=%%v&goto next<br/>:next<br/>set /p passcode=><br/>If %passcode%==%v% goto t<br/>If NOT %passcode%==%v% goto n<br/>:t<br/>echo password correct<br/>goto program<br/>:n<br/>echo password incorrect!<br/>pause<br/>exit<br/>:program<br/>echo yay!<br/>pause<br/><br/>can you just help me and correct the second piece of the code?</p></body></html> | |