Sample Batch File

See Also

If you type ss Checkout Help.c Help.H, and one of the two files is already checked out, VSS checks the other file out. The following batch file avoids this situation by checking the status of all the specified files and only checking them out if none of them is checked out.

The following sample demonstrates many of the features described in the two help topics How to Redirect Output and How to Disable Input, including the use of the following options:

This sample also uses the exit code of the Status command to determine whether files are checked out.

Sample of a Batch File

@echo off
ss status -o- -yThomas %1 %2 %3 %4 %5 %6 %7 %8 %9
if errorlevel 100 goto BAD_FAILURE
if errorlevel 1 goto CHECKED_OUT

rem Exit code 0, no files were checked out
echo No specified files are checked out: checking all out.
ss checkout "-cChecked out automatically" -yThomas %1 %2 %3 %4 %5 %6 %7 %8 %9
goto END

rem Exit code 1, something is checked out
:CHECKED_OUT
echo One or more files is checked out: quitting without checking anything out.
goto END

rem Exit code 100, something went wrong.
:BAD_FAILURE
echo Visual SourceSafe could not run successfully

:END