title: My batch file works, but for some reason also returns file not found
body: <p>My batch file reads all of the files from a windows directory with the option to include sub directories or not include them, and then saves the list to a txt file. It woks perfectly, but for some reason the application returns "File Not Found" after you answers yes or no to the sub directories question (although the question does function properly).. I'm new to batch programming, and this has me stumped.. Here is the code:</p>
  
  <pre><code>@echo off
  
  :start
  set /P DIRECTORY=Type Directory to Search: 
  if not exist %DIRECTORY% goto firstlogin
  
  :choice
  set /P c=Include Sub-Directories?[Y/N]?
  if /I "%c%" EQU "Y" goto :somewhere
  if /I "%c%" EQU "N" goto :somewhere_else
  goto :choice
  
  
  :somewhere
  dir -r -n -c -m /s /b /o  "%DIRECTORY%" &gt; C:\Users\Zack\Desktop\list_of_program_files.txt
  exit
  
  
  :somewhere_else
  
  dir -r -n -c -m /b /o  "%DIRECTORY%" &gt; C:\Users\Zack\Desktop\list_of_program_files.txt
  exit
  
  :firstlogin
  echo Directory does not exist!
  Pause
  goto :start
  </code></pre>