使用Powershell将静默安装程序作为作业运行

使用Powershell将静默安装程序作为作业运行,powershell,Powershell,这很好: 开始作业-名称notepadpp-脚本块{ c:\directory\install\npp.6.5.1.Installer.exe/S} 然而,这并不是: 开始作业-名称notepadpp-脚本块{& “$using:pwd\install\npp.6.5.1.Installer.exe/S”} 我错过了什么?应该是 Start-Job -Name notepadpp -ScriptBlock { & "$($using:pwd)\install\npp.6.5.1.Inst

这很好:

开始作业-名称notepadpp-脚本块{ c:\directory\install\npp.6.5.1.Installer.exe/S}

然而,这并不是:

开始作业-名称notepadpp-脚本块{& “$using:pwd\install\npp.6.5.1.Installer.exe/S”}

我错过了什么?

应该是

Start-Job -Name notepadpp -ScriptBlock { & "$($using:pwd)\install\npp.6.5.1.Installer.exe /S" }

抱歉耽搁了,但现在比以往任何时候都好,对吗?:)你很接近。启动作业-Name notepadpp-ScriptBlock{&“$($using:pwd)\install\npp.6.5.1.Installer.exe”/S}是正确的方法。
Start-Job -Name notepadpp -ScriptBlock { & "$($using:pwd)\install\npp.6.5.1.Installer.exe" /S }