title: Windows Batch Files: if else
body: <p>I'm doing a simple batch file that requires one argument (you can provide more, but I ignore them).</p>
  
  <p>For testing, this is what I have so far.</p>
  
  <pre><code>if not %1 == "" (
      dir /s/b %1
  ) else (
      echo no
  )
  </code></pre>
  
  <p>Basically, I want to say if an argument is provided, recursively display all the files in the folder.  Otherwise, say no.</p>
  
  <p>It works when I provide an argument, but if I don't provide one it'll just tell me <code>( was unexpected at this time</code>.</p>
  
  <p>I mean, it works, but I wanted to at least display a user-friendly message explaining why it doesn't work. How should I change the code?</p>