如何使用 Teamcity 在 windows 服务器上执行远程 .bat 文件

How to execute a remote .bat file on a windows server with Teamcity

我的 windows 服务器上有一个小的 .bat 文件,用作部署前的清理。 不幸的是,我无法通过任何 Teamcity 构建步骤执行此操作。

知道怎么做吗?我尝试了 "SSH Exec" 构建步骤,但找不到正确配置它的方法。

这是我的构建步骤:

这是构建错误:

[12:33:41]  [Step 5/8] Executing commands:
rmdir /Q /S "@CoopR"
on host [64.94.100.50]
[12:33:42]  [Step 5/8] The system cannot find the file specified

而且文件夹结构也是正确的:

尝试使用 powershell 的 Enter-PSSession cmdlet,它将在目标服务器上创建会话并执行所有进一步的命令,如本地(在目标机器上)。

如需更多帮助,请参阅文档:https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/enter-pssession?view=powershell-5.1