I am a batch newbie and I might have made a mistake. But I have the following post-build event:
IF $(ConfigurationName) == Release (
SET RELEASEPATH = "C:\Users\Synercoder\Documents\Visual Studio 2010\Releases\$(ProjectName)"
IF NOT EXIST %RELEASEPATH% (
GOTO MAKEDIR
) ELSE (
GOTO DIREXISTS
)
:MAKEDIR
MKDIR %RELEASEPATH%
:DIREXISTS
COPY /Y "$(TargetDir)$(ProjectName).dll" "%RELEASEPATH%\$(ProjectName).dll"
COPY /Y "$(TargetDir)$(ProjectName).pdb" "%RELEASEPATH%\$(ProjectName).pdb"
)
But this fails with code 255. If I replace all the %RELEASEPATH%
with the actual path it works. I looked up the SET
command and I think that I used it right... But like I said I am a batch newbie.
Any clue why this fails in my case?
If I use the following code this is my output:
SET RELEASEPATH = test
ECHO "%RELEASEPATH%"
SET RELEASEPATH = "test"
ECHO "%RELEASEPATH%"
Output:
""
""
First of all, spaces do matter! I would remove the " if I were you and only add them when the var is used.
SET RELEASEPATH=C:\Users\Synercoder\Documents\Visual Studio 2010\Releases\$(ProjectName)
IF NOT EXIST "%RELEASEPATH%" MKDIR "%RELEASEPATH%"