You need to enable delayed expansion using the SETLOCAL EnableDelayedExpansion command . Do this at the top of the post-build event. After that, you can access your variable using not% VARIABLE_NAME%, but! VARIABLE_NAME! (use an exclamation mark on both sides of the variable name, not the percentage character that you will use in a regular batch file).
So for example
SETLOCAL EnableDelayedExpansion IF $(ConfigurationName) == Release ( SET DESTINATION=$(ProjectDir)Output\Distribution echo My destination dir is !DESTINATION! )
This will output something like
My destination dir is D:\Work\Projects\PBExample\Output\Distribution.
source share