65.9K
CodeProject is changing. Read more.
Home

Use a Batch file to check-in files and folders using Visual SourceSafe

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.14/5 (4 votes)

Oct 15, 2007

CPOL

1 min read

viewsIcon

33251

downloadIcon

194

Simplicity is the core value of XP. Automate the check-in process in VSS to simplify the Build process.

Introduction

If you can automate a step in the development process, you should do so. That step can be the get (check-in) process from the source control software. In this article, I am trying to explain how to automate the Visual SourceSafe get process using a DOS batch file.

Solution

The batch file I created is shown below, and yours should look something like it. I used my favorite batch file editor, Notepad, but you can use any text editor, including Visual Studio.

Remember to change the names of the directories depending on where you have created the solution and where your Visual SourceSafe database is.

@echo off

set PATH=%PATH%;C:\Program Files\Microsoft Visual SourceSafe

rem: set the source safe database

set SSDIR=\\saserver\VSS

rem: set the working directory for the source safe database root project

ss Workfold $ E:\VSS -Y%2,%3

rem:change to the directory where all the projects work is

cd E:\VSS\%1

rem: get the latest version of the source files from source safe

ss get *.dll $%1 -I- -Y%2,%3

rem: Back to original folder

cd E:\VSS\Projects\ApplicationDesigner\ImplementSet\SA.App.Designer

The getApp.bat batch file uses the get.bat file to get the various folders as follows:

@echo off

call get.bat "Projects\ApplicationDesigner\ImplementSet\ExternalLibrary" ansari 123

call get.bat "Projects\CustomerService\ImplementSet\Release 1.0\
              Presenter\ExternalLibrary" ansari 123

call get.bat "Projects\CustomerService\ImplementSet\Release 1.0\
              WinUI\ExternalLibrary" ansari 123

call get.bat "Services\Common\ImplementSet\WinUI2007\ExternalLibrary" ansari 123

exit
  • ss get uses:
    • -I flag to ignore all the prompts and to tell the command not to ask for input under any circumstances.
    • -Y flag specifies a user name or user name and password. Use this option if you want to execute a command as another user.
  • SSDIR specifies the location of the Srcsafe.ini file for a Visual SourceSafe database to which to connect.
  • ss Workfold sets the working folder.

References