title: Batch file - check if command is available
body: <p>I'm writing a small batch file in windows that needs to run a nodejs app. Before running the app I need to make sure that node is installed by the user, and if not show him a message that node is required.</p>
  
  <p>What I did is this:</p>
  
  <pre><code>@echo OFF
  
  setlocal EnableDelayedExpansion
  
  REM Check if node is installed
  for /f "delims=" %%i in ('node -v') do set output=%%i
  
  IF "!output!" EQU "" (
      echo node could not be found
  ) else (
      node %~dp0app.js
  )
  </code></pre>
  
  <p>If the user has node installed then <code>output</code> will contain the version number. If not installed then it will be empty. This logic works. But if node is not installed (<code>node -v</code> command not found), the batch result also shows the following output:</p>
  
  <pre><code>'node' is not recognized as an internal or external command,
  operable program or batch file.
  node could not be found
  </code></pre>
  
  <p>I would like to hide the "not recognized" message from the user and just show "node could not be found".</p>
  
  <p>How can I hide it?</p>