Dos Prompt - Batch file programming - Preparing executables for deployment(more straightforward way)

All I want to do is to get a set of binaries from projects in solution file (.NET win application) in the debug/release folder and put into one target folder so then I can quickly deploy into staging environment for testing.

I do not want to create the setup packages because I want to retain the pdb files in it (for debug version). I know this can be done using the package setup too and also some well build automation script to include debug database but too much of hassle and I want to do it across many projects. Also, I do not want to purchase another tool for simple stuff like this. All I want is a generic script for all kind of the projects.

So, here, I come out with a batch file

There are some approach in batch programming where a batch will read from another text file (the locations of the project). But i like to put all the location setting to the batch file. Easy to keep track and feel like in control all the time. Too many files to maintain not my preference that all.

Here goes the script.




SET FOLDER1=Project1

SET FOLDER2=Project2
SET FOLDER3=Project3

SET FOLDER4=Project4

SET FOLDER5=Project5

@echo off & setLocal EnableDELAYedeXpansion


for /Lfor /L %%i in (1 1 5) do


echo.FOLDER%%i is !FOLDER%%i!

pushd !FOLDER%%i!
pushd "bin\Debug"

if not exist *.dll goto ERROR


xcopy xcopy *.* %OUTPUTLOCATION%\!FOLDER%%i!




 :QUIT echo Done EXIT /B 1

:ERROR echo Error occurredEXIT /B 1


Popular posts from this blog

Clearcase check in/uncheck out all the checked out files script


Duplicating a local copy of project from TFS and making web software client factory to work