Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: help me correct the code!  (Read 8160 times)

0 Members and 1 Guest are viewing this topic.

lolhelpme

    Topic Starter


    Newbie

    • Experience: Familiar
    • OS: Windows 8
    help me correct the code!
    « 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?