小编use*_*164的帖子

启动过程系统找不到指定的文件

需要一些帮助来查找以下问题。

问题在于$ 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"
Run Code Online (Sandbox Code Playgroud)

以下作品我将值硬编码

Invoke-Command -ComputerName $SpecIP -Credential $cred -ScriptBlock {
param($setup)
Start-Process -workingdirectory c:\temp 1.1.1.1 Responses.txt -wait
} -ArgumentList $setup
Run Code Online (Sandbox Code Playgroud)

不起作用唯一的不同是$ setup

Invoke-Command -ComputerName $SpecIP -Credential $cred -ScriptBlock {
param($setup)
Start-Process -workingdirectory c:\temp $setup -wait
} -ArgumentList $setup
Run Code Online (Sandbox Code Playgroud)

错误

由于出现错误,因此无法运行此命令:系统找不到指定的文件。+ CategoryInfo:InvalidOperation:(:) [Start-Process],InvalidOperationException + FullyQualifiedErrorId:InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCo …

powershell-3.0

2
推荐指数
1
解决办法
5125
查看次数

标签 统计

powershell-3.0 ×1