I want to store projects build numbers, build date and build time into file after triggering the job. I tried for this ans but it is storing the latest build number into file and deleting the previous one.
Windows Platform - Execute windows batch command
echo jenkins-build=%BUILD_NUMBER% > Drive:\path\to\file.properties
The problem is with the output redirection using >
. A single >
creates a new file and writes to it.
To append to an existing file, you should use >>
(it will still create the file if it doesn't exist).
Reference: https://ss64.com/nt/syntax-redirection.html