【发布时间】:2020-05-18 19:49:06
【问题描述】:
编辑: 我想通过虚拟机管理器 PowerShell cmdlet 计算存储容器的文件/文件夹。
我遇到了类似的问题,但仍然在语法上苦苦挣扎。 我有一个在远程服务器上执行 PowerShell 脚本的 ruby 脚本。 我想在 Powershel 脚本中使用 ruby 变量。 例如
path_str = "\\XXX\YYY\" #This is the ruby var
PSoutput = shell.run(" #This part is executing the PS script
$Files = Get-ChildItem -Recurse -File -Path #{path_str} | Measure-Object | %{$_.Count}" | stdout
如何在 PS 脚本中使用 ruby 变量 path_str? 我试过了
# {path_str}
\" " + path_str + " \"
双引号和单引号
没有什么对我有用。
【问题讨论】:
-
“没有什么对我有用”是什么意思?请发帖minimal reproducible example。
标签: ruby powershell powershell-remoting winrm