You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows无人值守安装中如何同步监控日志并继续软件安装

解决方案

直接用Start-Process启动独立的PowerShell窗口运行日志监控命令,这样当前脚本不会被阻塞,能继续执行后续的安装操作。

核心命令示例

# 启动独立PowerShell窗口持续监控日志
Start-Process powershell.exe -ArgumentList "-NoExit", "-Command", "Get-Content 'C:\windows\setup\scripts\FirstLogon.log' -Wait"

# 继续执行后续的winget/choco安装命令
winget install --id Microsoft.VisualStudioCode -e
choco install googlechrome -y
# 其他软件安装命令...

参数说明

  • -NoExit:让新的PowerShell窗口保持打开状态,不会因为监控命令启动后就自动关闭。
  • -ArgumentList:将监控命令作为参数传递给新启动的PowerShell进程,实现独立运行。

优化版(带窗口标题)

如果需要快速识别监控窗口,可以给窗口设置标题:

Start-Process powershell.exe -ArgumentList "-NoExit", "-Command", "`$Host.UI.RawUI.WindowTitle='安装日志实时监控'; Get-Content 'C:\windows\setup\scripts\FirstLogon.log' -Wait" -WindowStyle Normal

内容的提问来源于stack exchange,提问作者Eric Chang

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 22:47:02