Yea, I know. Logically, a return code of zero is probably correct. But when you consider the return code description "Files were copied without error" then I would expect a non-zero return code for this situation.
Maybe xcopy needs a 6th return code: 5 - files were not copied without error. That would take away any confusion, right? I believe Copy only returns 0 for success or 1 for failure. Dominique Dominique I didn't realize that.
The copy x y was arbitrary, I did not mean to imply renames only. I've been using the 0 and 1 return codes with copy and they work fine. MyStackRunnethOver 3, 2 2 gold badges 24 24 silver badges 37 37 bronze badges.
Jeremy Dowsett Jeremy Dowsett 1. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Helping communities build their own LTE networks.
Podcast Making Agile work for data science. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Search for: Search.
Skip to content. Batch files return code: Introduction Error level in batch file Batch files return code: Example. Batch — loops. Batch Functions. Incorrect function. Indicates that Action has attempted to execute non-recognized command in Windows command prompt cmd. Program is not recognized as an internal or external command, operable program or batch file. Indicates that command, application name or path has been misspelled when configuring the Action.
What matters is did the script work or not? You may also want to check for specific error codes. For example, you can test that an executable program or script is in your PATH by simply calling the program and checking for return code Remember, this is duct tape programming.
I use this technique heavily to halt a script when any error is encountered. By default, the command processor will continue executing when an error is raised. You have to code for halting on error.
0コメント