Can we execute a .bat file in post build event command line in visual studio?

build-automation, visual-studio, visual-studio-2005, visual-studio-2008

Solution

Sure, here's an example:

call "$(SolutionDir)scripts\copyifnewer.bat" "$(SolutionDir)libs\RLPL.Services.CertificateValidator.Basic.dll" "$(TargetDir)RLPL.Services.CertificateValidator.Basic.dll"
call "$(SolutionDir)scripts\copyifnewer.bat" "$(SolutionDir)libs\RLPL.Services.CertificateValidator.Common.dll" "$(TargetDir)RLPL.Services.CertificateValidator.Common.dll"

Just be aware of two possible issues you might have:

the enclosing double quotes (see how each part is surrounded by `"` sign)

if you want to call 2 or more batch files make sure you use `call` command otherwise you'll have a trouble finding why the second bat is not doing its job

Problem

Can we execute a .bat file in post build event command line in visual studio?

Original source