【发布时间】:2010-11-19 01:44:00
【问题描述】:
我正在尝试使用 tf rename、PowerShell 和正则表达式递归地重命名一堆 TFS 文件夹,但我在使用 PowerShell 时遇到了一些问题,因为我没有花太多时间使用它。到目前为止,这是我用2.3.2 替换领先的5 的内容,但它不起作用:
dir | foreach { tf rename $_ { $_.Name -replace '^5', '2.3.2' } }
实际结果:
无法识别的命令选项“encodedCommand”。 无法识别的命令选项“encodedCommand”。 无法识别的命令选项“encodedCommand”。 无法识别的命令选项“encodedCommand”。 ...等等。更新:
通过执行以下操作,我离得更近了一点:
dir | foreach { $newname = $_.Name -replace "^5", "2.3.2"; tf rename $_ $newname }
我的下一个目标是创建这个递归子目录,但这似乎更具挑战性(将其更改为 dir -recurse 会使其在父文件夹之后退出)。
【问题讨论】:
-
不知道答案,但这是个好问题。 :)
标签: tfs powershell