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

Panda picture Panda · Sep 29, 2009 · Viewed 81.1k times · Source

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

Answer

Piotr Owsiak picture Piotr Owsiak · Jul 23, 2010

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:

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

  2. 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