1

我想在 Windows 10 中通过 DISM 安装 UWF 功能。这行得通!但是,我需要多次执行此操作,因此我在批处理文件中有 DISM 命令。当 DISM 命令成功时,它会询问我是否要重新启动。我如何提供(管道)答案?以下不起作用:

echo n | DISM /online /Enable-Feature...

我怎样才能做到这一点,以便用 n(否)自动回答重新启动问题?

谢谢

4

2 回答 2

1

您可以运行DISM /?以显示部署映像服务和管理工具 (DISM) 的文档页面。

您将在文档中看到标题为DISM OPTIONS:

DISM OPTIONS:

  /English                - Displays command line output in English.
  /Format                 - Specifies the report output format.
  /WinDir                 - Specifies the path to the Windows directory.
  /SysDriveDir            - Specifies the path to the system-loader file named
                            BootMgr.
  /LogPath                - Specifies the logfile path.
  /LogLevel               - Specifies the output level shown in the log (1-4).
  /NoRestart              - Suppresses automatic reboots and reboot prompts.
  /Quiet                  - Suppresses all output except for error messages.
  /ScratchDir             - Specifies the path to a scratch directory.

本节详细介绍了/NoRestart您正在寻找的选项。

您可以将其应用于您的脚本,如下所示...

DISM /online /Enable-Feature... /NoRestart
于 2021-04-23T14:39:37.910 回答
0

显然,有一个未记录的开关 /norestart 只是做我想要的,我将它附加到命令的后面:

DISM /online /Enable-Feature... /norestart

我在检查 DISM 命令的 powershell 版本时发现了这一点。

于 2018-11-27T09:46:04.090 回答