Batch Script not raising ERRORLEVEL on failure
问题 I am learning Windows batch scripting. I need to raise errors when copy, move or delete operations fail. I have made a sample script and for some reason, when the operation fails I cannot get the ERRORLEVEL to rise. I run the script and the files either do not exist or are opened in another program and stderr messages are output to console, but ERRORLEVEL never rises, why is this? Also, is there any way to pipe stderr into a variable I could check, if I cannot get ERRORLEVEL to rise? My code