【问题标题】:Can i automate product version with script file?我可以使用脚本文件自动化产品版本吗?
【发布时间】:2014-05-13 09:54:45
【问题描述】:

我想自动化更新版本号的过程。我在 .cs 文件中的一个 const 字符串变量中维护版本号。在我的 .cs 文件中,我也有其他变量。

如何遍历文件以查找字符串变量值,然后用新值更新它?

【问题讨论】:

  • .cs?那不是 C#,而不是 vbs?

标签: batch-file vbscript build-automation


【解决方案1】:

.cs 文件只是纯文本,因此只需使用 For 循环和 Set 字符串替换。

@echo off
setlocal enabledelayedexpansion
(for /f "tokens=*" %%f in (input.cs) do (
        set "line=%%f"
        set "line=!line:Find=Replace!"
        echo(!line!
)) > tmp.txt
Move /y tmp.txt input.cs

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-31
    • 1970-01-01
    • 1970-01-01
    • 2022-11-10
    • 1970-01-01
    相关资源
    最近更新 更多