On Windows 9x, COMSPEC was command.com. The main reason it was created was ability to create batch files which work both on Windows 9x and Windows NT. These days Microsoft mostly keeps it around for backwards compatibility.Midas wrote: ↑Fri Jan 22, 2021 5:50 amwebfork wrote:I've never seen that COMSPEC function before or understood it as necessary. I've always liked how straightforward Windows batch files are -- what a weird addition.
Not trying to be pedantic, but %COMSPEC% is a system variable* that always points to CMD.exe. As different systems go, I have found it is a useful trick to ensure that batches won't choke on non-standard Windows setups. Plus, it avoids pointless typing.
*) You can check for more by running SET without parameters in a CLI...
I'd just write cmd.exe directly instead.