@Echo Off
If "%os%"=="Windows_NT" goto NT
Echo 95
GoTo End
:NT
Echo NT
:End

This will branch correctly in both NT and 95, and do not produce a syntax error in 95