Quick one based on a forum question where somebody asked how to detect if VSDBCMD.EXE failed or succeeded inside a batch file.

VSDBCMD.EXE does not return a very elaborate amount of information, there are just two return values 0 and 1, where zero indicates success and 1 failure. So in order to test for this you simply check the ERRORLEVEL inside your batch file.

This is a simple wrapper that I use that shells out to VSDBCMD.EXE and passes all the parameters, so I do not have to place the Deploy directory on the PATH.

   1:  @echo off
   2:  setlocal
   4:  if "%PROCESSOR_ARCHITECTURE%"=="x86" call "%ProgramFiles%\Microsoft Visual Studio 9.0\VSTSDB\Deploy\vsdbcmd.exe" %*
   5:  if "%PROCESSOR_ARCHITECTURE%"=="AMD64" call "%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VSTSDB\Deploy\vsdbcmd.exe" %*
   7:  if errorlevel 1 @echo vsdbcmd.exe failed&goto end
   8:  if errorlevel 0 @echo vsdbcmd.exe succeeded&goto end
  10:  endlocal
  12:  :end

The checks for PROCESSOR_ARCHITECTURE make sure I can find the executable in the right location depending on the fact if I am running with a x32 or x64 CMD.EXE instance.

Also published on: http://www.dbproj.com/Tutorials/tabid/62/TID/16/cid/21/Default.aspx

Have fun,

GertD @ www.DBProj.com