title: Batch File input validation - Make sure user entered an integer
body: <p>I'm experimenting with a Windows batch file to perform a simple operation which requires the user to enter a non-negative integer. I'm using simple batch-file techniques to get user input:</p>
  
  <pre><code>@ECHO OFF
  SET /P UserInput=Please Enter a Number: 
  </code></pre>
  
  <p>The user can enter any text they want here, so I would like to add some routine to make sure what the user entered was a valid number. That is... they entered at least one character, and every character is a number from 0 to 9. I'd like something I can feed the UserInput into. At the end of the routine would be like an if/then that would run different statements based on whether or not it was actually a valid number.</p>
  
  <p>I've experimented with loops and substrings and such, but my knowledge and understanding is still slim... so any help would be appreciated.</p>
  
  <p>I could build an executable, and I know there are nicer ways to do things than batch files, but at least for this task I'm trying to keep it simple by using a batch file.</p>