I am having an issue with a build batch file from a third-party project I am working with. It does a check for if the OS is Windows by using the
ver command. Unfortunately, I cannot seem to print the
ver command from the batch file as it does on the command line. The command line output is:
Microsoft Windows [Version 10.0.15063]
However, when I run in a batch file:
set v ver echo %v%
The output is instead:
v=10.0 VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\ VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\ VS90COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\
Which appears to be giving me the windows version (though not in as full detail), and then versions of a bunch of other things. Is there a reason why this would work differently or is failing? Does anyone know how to call the original behavior which is observed at the command line? The third party script appears to be expecting the behavior for the command line version.
Update: Based on the answer below, I have found that while this was an issue, it was not the issue that was actually causing the third-party batch file to fail. That seems like it must be due to an issue with
%ERRORLEVEL% NEQ 0 (since the problem is that it thinks it did not find the string "Windows" in the version).