以下参数Split-Path
不正确,应该是$delZipExe
。
这使得$delZipCmd
散列被设置为空。
我希望WorkingDirectory
值在$delZipCmd
散列中设置为空。Powershell splat销毁变量
为什么会发生这种情况?
Set-StrictMode -Version latest
$delZipExe = '\\servername\ziptools\SP3DDeliverZips.exe'
$delZipDest = "D:\"
$delZipArgs = @('/execute',
'/source', '/RAD ', '/debugpdb', '/wait'
)
$delZipCmd = @{ FilePath = $delZipExe;
ArgumentList = $delZipArgs;
NoNewWindow = $true;
WorkingDirectory = (Split-Path $delZipCmd); # <== should be $delZipExe
Wait = $true;
}
$delZipCmd | ft
我不明白你的问题,你做了什么错误,你期待什么,也没有人知道第10行的注释你的代码意味着什么。你能澄清吗? –
在最后一行,$ delZipCmd是$ null。正如我在问题中所说的,我想明白为什么会发生这种情况,因为我预计WorkingDirectory的值将为$ null,但所有其他条目的设置都会正确。 – opedroso