目前的 project 是會去讀某個特定檔案裡的字串來當作 installer 的版號 而且剛好 build 環境有裝 perl 所以要用 Jenkins 的 build 版號來取代那個特定的檔案就變得超容易 set /a BUILD_VER=%BUILD_NUMBER%+2140 perl -pi.bak -e 's/2140/%BUILD_VER%/g' src\path\to\version.h -p processes, then prints <> line by line -i activates in-place editing. Files are backed up using the .bak extension REF: How to replace a string in an existing file in Perl?