运行powershell的批处理文件

时间:2016-09-15 20:49:15

标签: powershell-v4.0

我有一个PowerShell脚本来运行msu文件

Start-Process wusa.exe \\hqfs1\users\tantony\PowerShell\WinUpdate\Win7AndW2K8R2-KB3134760-x64.msu

然后,我有一个运行powershell脚本的批处理文件

powershell -ExecutionPolicy ByPass -noexit "& ""\\hqfs1\users\tantony\PowerShell\WinUpdate\winupdate.ps1""" /quiet /norestart

有没有办法在批处理文件中添加/quiet /norestart,以便msu以静默方式运行而无需用户交互?

1 个答案:

答案 0 :(得分:0)

这样的事情应该有效:

$update = '\\hqfs1\users\tantony\PowerShell\WinUpdate\Win7AndW2K8R2-KB3134760-x64.msu'
Start-Process wusa.exe ((,$update + $args) -join ' ')
相关问题