For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set thedate=%%c_%%a_%%b) echo %thedate% mkdir C:\Users\avalencia\test2\${system.thedate}_${bamboo.custom.svn.revision.number} xcopy.exe TechServiceTool\TechServiceTool\bin\Release C:\Users\avalencia\test2\${system.thedate}_${bamboo.custom.svn.revision.number}\ /e
per build log, date evaluates correctly in the first line (set thedate=%%c_%%a_%%b), but is not usable in the lines afterward. how can I use thedate batch variable after it is correctly set in the first line. the goal is to have the date in a specific format to use to create a directory in which to put the build. i'd rather not create an msbuild or ant file just for this.
I never could get system variables to work either. I use the injection plugin as a work around. Clunky but it works. And specifically it was on the date. Seems like a useful idea for an enhancement. have today's date as a bamboo variable since so many of us use dates in folder names (to hold builds for deployment etc.)
xcopy, as it turns out, creates all intermediary directories, making the mkdir statement unneccessary. the echo statement was there just as a test. only one statement uses the variable. so, i simply made that last statement my do body rendering the batch variable useless. until somebody can figure out how to set batch variables in a script batch task, the solution to this problem is.
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (xcopy.exe TechServiceTool\TechServiceTool\bin\Release C:\Users\avalencia\test2\%%c_%%a_%%b_${bamboo.custom.svn.revision.number}\ /e)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried just %thedate% ? Bamboo system variables are only updated at task boundaries, and not within a task.
Do you need the value in future tasks>?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes i have tried %thedate%, and nothing gets substituted. essentially, it seems that the set command does not get executed. or, if it does, the variable is seemingly useless thereafter. i do not need the value in future tasks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you pull this code into a .bat file and run manually does it give the result you expect (other then svn which will be missing).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes. i see where we're going with this. i believe the svn var evaluates w/in the task prior to functional parameterization. if not, then that will be the next barrier. i really didn't want to have to check any build-specific files into SVN which accomplish such trivial tasks. the script task, executable as a batch file should not be advertised as such if not the case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.