tag:help.appveyor.com,2012-11-13:/discussions/questions/1855-using-version-in-cmd-build_beforeAppVeyor: Discussion 2018-10-19T08:17:34Ztag:help.appveyor.com,2012-11-13:Comment/383841022015-11-05T07:01:18Z2015-11-05T07:01:18ZUsing {version} in cmd build_before<div><p>Try:</p>
<pre>
<code>- cmd: >-
cd MyDir
SetVersion %APPVEYOR_BUILD_VERSION%
cd ..</code>
</pre></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/383841022015-11-05T07:06:08Z2015-11-05T07:06:08ZUsing {version} in cmd build_before<div><p>Thanks! That was fast :-)</p></div>Christiantag:help.appveyor.com,2012-11-13:Comment/383841022015-11-05T09:16:55Z2015-11-05T09:16:56ZUsing {version} in cmd build_before<div><p>I have a follow-up question: My build still fails, output:</p>
<p>cd MyDir<br>
SetVersion %APPVEYOR_BUILD_VERSION%<br>
Usage : SetVersion , where should be ...<br>
Example: SetVersion 1.0.1.42<br>
cd ..</p>
<p>My batch script (which is only a frontend for a powershell
script) looks as follows:</p>
<p>@echo off</p>
<p>if "%1"=="" goto _USAGE</p>
<p>PowerShell.exe -ExecutionPolicy Bypass -File "SetVersion.ps1"
-version "%1"</p>
<p>:_USAGE echo Usage : SetVersion ^, where ^ should be ^.^.^.^<br>
echo Example: SetVersion 1.0.1.42</p>
<p>If I run the script locally, i.e. "SetVersion 0.2.0.42", it
works fine. Does this mean that the binding of the version to the
environment variable APPVEYOR_BUILD_VERSION has failed for some
reason?</p>
<p>On a side note, I have noticed that in general, the build output
does not show the actual values which are substituted for the
AppVeyor env variables, but the env variables themselves (i.e., as
can be seen within the appveyor.yml config file. Is this on
purpose? I guess that I would prefer to see my commands as actually
executed (i.e., with the substituted values), but I might very well
not see the reasons for not doing so...</p>
<p>Thanks again,<br>
Christian</p></div>Christiantag:help.appveyor.com,2012-11-13:Comment/383841022015-11-05T18:45:26Z2015-11-05T18:45:26ZUsing {version} in cmd build_before<div><p>Stupid me... Of course, the script runs through the usage
section, no matter if a value is passed or not - there's a "goto
:eof" missing :-(</p></div>Christian