1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Batch file password!

Discussion in 'Programming' started by BoylesWhite, Sep 3, 2008.

  1. BoylesWhite

    BoylesWhite New Member

    Joined:
    Aug 24, 2008
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    I have been programing a batch file for a folder i wuold like to protect. But The batch script will not work no matter how hard i try. I'm not too familiar with the set command and believe this is where i am going wrong. I would appreiciate help with this. And if anyone has recommended sources i would find this hand. Here is what i have so far. I have replaced the file route and passord this is not the programming error:
    @echo off

    title Open File
    Echo Please enter password
    set/p "pass=>"
    if %pass%=="my password" goto passed
    if NOT %pass%=="my password" goto FAIL

    :passed
    start c:\WINDOWS\"foldername"
    goto :end

    :FAIL
    Echo Incorrect Login
    pause
    goto :end

    :end
    exit


    Thanks in adveanced.
     
  2. oogabooga

    oogabooga New Member

    Joined:
    Jan 9, 2008
    Messages:
    115
    Likes Received:
    11
    Trophy Points:
    0
    SET with the prompt option works like this:
    Code:
    C:> SET /P myvar="Enter password: "
    Enter password: abcdef
    C:> SET myvar
    myvar=abcdef
    
    To get help for SET, use HELP SET.
    (Or "HELP SET > set.txt" and read it in notepad.)
    HELP by itself lists all commands.
    Google "windows batch files" for tutorials.
     

Share This Page