需要一些帮助来查找以下问题。
问题出在$ setup周围
开始进程-工作目录c:\ temp $ setup -wait
$storageDir = 'C:\Temp'
$file = '1.1.1.1'
$SpecIP = '192.168.0.87'
$password = ConvertTo-SecureString "Password" -AsPlainText -Force
$user = "User1"
$cred = New-Object System.Management.Automation.PSCredential ($user,$password)
$rsName = 'Responses.txt'
$setup = "$file.exe $rsName"
以下作品我对值进行硬编码
Invoke-Command -ComputerName $SpecIP -Credential $cred -ScriptBlock {
param($setup)
Start-Process -workingdirectory c:\temp 1.1.1.1 Responses.txt -wait
} -ArgumentList $setup
不起作用,唯一的不同是$ setup
Invoke-Command -ComputerName $SpecIP -Credential $cred -ScriptBlock {
param($setup)
Start-Process -workingdirectory c:\temp $setup -wait
} -ArgumentList $setup
错误
由于以下错误而无法运行此命令:系统找不到指定的文件。+ CategoryInfo:InvalidOperation :( :) [开始进程],InvalidOperationException+ FullyQualifiedErrorId:InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCoand+ PSComputerName:192.168.0.87
我发现了问题。我需要在exe名称前添加.\
。
$setup = ".\$dirchosen.exe $rsName"
Start-Process powershell -workingdirectory c:\temp "$setup" -wait
我刚运行az --version
并得到
azure-cli 2.5.1
command-modules-nspkg 2.0.3核心2.5.1nspkg 3.0.4遥测1.0.4
扩展名:azure-cli-iot-ext 0.8.9天青石0.9.2
Python位置'C:\ Program Files(x86)\ Microsoft SDKs \ Azure \ CLI2 \ python.exe'扩展目录'C:\ Users \ DavidJones.azure \ cliextensions'
Python(Windows)3.6.6(v3.6.6:4cf1f54eb7,2018年6月27日,02:47:15)[MSC v.1900 32位(Intel)]
法律文档和信息:aka.ms/AzureCliLegal
您的CLI是最新的。
[请让我们知道我们的情况:https://aka.ms/clihats并告诉我们您是否有兴趣尝试我们的最新功能:https://aka.ms/CLIUXstudy按任意键返回。这些链接是可点击的