Powershell - 从哈希到字符串

时间:2016-09-05 09:29:28

标签: powershell teamcity

需要解决一些问题...在teamcity上,我收到了vcs内部版本号为hash,f.e。 0630ad46ed0b297641151d64337faf3fc44078c8。在Powershell步骤中,我需要从这个哈希(子串前8个符号)创建版本,但命令 $version = %build.vcs.number.****无效(如果您尝试发出命令$version = 0630ad46ed0b297641151d64337faf3fc44078c8,则相同):该字词未被识别为名称...

如何将此变量包装成字符串?

1 个答案:

答案 0 :(得分:0)

实测值。需要使用命令Out-String之类的 $hash = Out-String -InputObject %build.vcs.number%