I'd always noticed that setenv cleared the screen, but I never took the time to figure out why...
:: Read the value for VCRoot and VSRoot from the registry.
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "%RegKeyPath%" /v 9.0') DO SET VCRoot=%%B
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "%VSRegKeyPath%" /v 9.0') DO SET VSRoot=%%B
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "%RegKeyPath%" /v 9.0') DO SET VCRoot=%%B
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "%VSRegKeyPath%" /v 9.0') DO SET VSRoot=%%B
:: Hide the error output from the call to 'REG' since VCRoot and VSRoot have already been set
:: to a default value.
CLS
:: to a default value.
CLS
Might be nicer to actually redirect the output...
:: Read the value for VCRoot and VSRoot from the registry.
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "%RegKeyPath%" /v 9.0 ^>NUL 2^>^&1') DO SET VCRoot=%%B
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "%VSRegKeyPath%" /v 9.0 ^>NUL 2^>^&1') DO SET VSRoot=%%B
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "%RegKeyPath%" /v 9.0 ^>NUL 2^>^&1') DO SET VCRoot=%%B
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "%VSRegKeyPath%" /v 9.0 ^>NUL 2^>^&1') DO SET VSRoot=%%B
...and less annoying when you're invoking setenv from an existing cmd shell...