The thing is that redirecting errors to the file in command line doesn't work. I will explain this by giving an example.
ping /wrong > output.txt 2> error.err
produces empty error.err file and output.txt with error text . That's huge surprice since this synthax is given in MS docs and literally everywhere over the web.
Using >> instead of > with 2>> instead of 2> doesn't change command line behaviour. I've also tried running it as script with .cmd extension, running with command line in admin mode and none of this help.
Moreover, ping /wrong 2> error.err ends up with error apearing in console (which doesn't happened in previous example since it was redirected). Any thoughts?
pingis strange in more than this issue. If you ping a non-existent IP in your local network, you get something like "reply from <localhost>: destination not reachable", which is a positive reply (although not from the pinged host) and%errorlevel%gives0, indicating "success".