title: How to know whether a command is executed successfully via a batch file?
body: <p>For example, in a batch file, I typed the command below:</p>
  
  <p>xcopy C:\fileA.txt D:\Dir\ /y /d</p>
  
  <p>It will fail absolutely if there was not a file called fileA.txt. But I want to know if it fails, then output some messages to user. How can I do this?</p>
  
  <p>Any help will be grateful, thanks!</p>