Windows 8 Powershell Enable-WindowsOptionalFeature bat文件 [英] Windows 8 Powershell Enable-WindowsOptionalFeature bat file
问题描述
我有一个运行powershell脚本的.bat文件。这是它
I have a .bat file that runs a powershell script. This is it
powershell -Command "& {Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole}"
之前我已经完成了这个,如果我想添加另一个命令,我会在结束括号前加一个分号并继续脚本。
I have done this before and if I wanted to add another command I would put a semicolon before the closing brace and continue the script.
此命令在完成后要求我选择是否以Y或N重新启动计算机。
This command however after completed requires that I choose wheter or not to restart the computer with a Y or N.
有人知道怎么在论证中传递这个或者一起避免这一步吗?
Does anyone know how to pass this in an argument or avoid this step all together?
提前致谢
注意:您必须以管理员身份运行.bat文件
Note: you have to run the .bat file as adminstrator
推荐答案
从 Get-Help启用-WindowsOptionalFeature - 完整
:
-NoRestart [<SwitchParameter>]
Suppresses reboot. If a reboot is not required, this command does nothing. This option will keep the
application from prompting for a restart or keep it from restarting automatically.
将 -NoRestart
标志添加到启用-WindowsOptionFeature
以禁止重新启动。如果您执行想要在完成后重新启动,请使用命令重新启动计算机
。
Add the -NoRestart
flag to Enable-WindowsOptionFeature
to suppress the reboot. If you do want to reboot after completion, use the command Restart-Computer
.
这篇关于Windows 8 Powershell Enable-WindowsOptionalFeature bat文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!