title: For /F Combined with Findstr to store a specific Text in File to a Variable
body: <p>So I have a file named as Userdetails.dll
  It contains  the following content.</p>
  
  <p>ABC XYZ</p>
  
  <p>DEF ZYX</p>
  
  <p>GHI YXZ</p>
  
  <p>Let's say the strings on the left side of each line are the names of users and the ones on the right are passwords.</p>
  
  <p>Now, how do I create a batch file wherein the User is allowed to input his User name. The script then checks if the user name is valid from the list. If it is valid, it allows the user to input the password, if not then it exits. If the password inputted by the user matches with that mentioned in the .txt file, then it prints "Logged in" (ie Echo Logged in). If not it echoes "Invalid Password" and loops the user to Entering the Password Stage.</p>
  
  <p>I have tried searching the the forum for this, but I did not find any   direct link. However all of the links led me to the use of For /f and Findstr in my code.
  I need to know how to use for /f and findstr to provide the desired result.
   for /f %%A in ('findstr "User" userdetails.txt') d
  o set usrname=%%A</p>
  
  <p>However it returns the username and not the relevant password of the user.
  Hence I would like to know how to use the command to return password from the username inputted by searching it in the file.
  <strong>Note. I am not a programmer(by profession). Hence I request you to explain me the code you have written line by line. Thanks a lot.</strong></p>