0

我在我的预构建事件中运行以下命令

(get-content "$(SolutionDir)woop.txt") -replace 'HELLO','GOODBYE' | set-content "$(SolutionDir)woop.txt"

但是我收到以下错误:

该命令"(get-content "C:\Users\jonny\Desktop\data\a\woop.txt") -replace 'HELLO','GOODBYE' | set-content "C:\Users\jonny\Desktop\data\a\woop.txt""以代码 255 退出。

有人有任何想法吗?

4

1 回答 1

1

构建事件脚本是基于 dos 脚本的,而不是 PowerShell ......

我建议您将脚本包装在 ps1 文件中,然后使用适当的参数执行 powershell.Exe。

编辑

本文展示了如何做到这一点。

于 2011-07-05T15:10:57.067 回答