从 Windows 8 中批量删除按需功能负载?

Mar*_*oof 3 windows disk-space-utilization dism

没有运行dism /online /disable-feature /remove /featurename:featurename我想要修剪的每个功能,有没有办法删除磁盘上所有禁用功能的有效负载?

小智 9

Windows 8 中的 Powershell 3.0 提供了一个名为Get-WindowsOptionalFeature的新 cmdlet ,可用于查询功能及其当前状态。通过一些过滤,您可以沿着链传递它并为每个功能执行 dism。

Get-WindowsOptionalFeature -Online | where { $_.State -match "Disabled" } | `
    foreach { `
        $_ = $_.FeatureName; `
        DISM /Online /Disable-Feature /FeatureName:$_ /Remove `
    }
Run Code Online (Sandbox Code Playgroud)

附加链接