scala.bat does not double quote the %COMSPEC% path variable when setting the exit code (last line of the script):
@@%COMSPEC% /C exit %errorlevel% >nul
@@"%COMSPEC%" /C exit %errorlevel% >nul
This is usually ok because cmd.exe is in system32 by default (that path has no space in it), but it can be elsewhere in some configs and it creates a useless error message when the user is closing the REPL, like 'Unknown command "C:\Program"'
Related scala-user discussion: https://groups.google.com/d/topic/scala-user/FBgClRSJ2qc/discussion