码迷,mamicode.com
首页 > Windows程序 > 详细

windows 10 重新安装 默认软件

时间:2018-03-08 20:19:46      阅读:1870      评论:0      收藏:0      [点我收藏+]

标签:var   输入   match   dna   cut   出现   where   粘贴   string   

1 管理员权限打开powershell

2 输入 Set-ExecutionPolicy Unrestricted 出现选项,输入Y

3 将下列代码粘贴输入:

# Get all the provisioned packages
$Packages = (get-item HKLM:\Software\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications) | Get-ChildItem

# Filter the list if provided a filter
$PackageFilter = $args[0]
if ([string]::IsNullOrEmpty($PackageFilter))
{
    echo "No filter specified, attempting to re-register all provisioned apps."
}
else
{
    $Packages = $Packages | where {$_.Name -like $PackageFilter} 

    if ($Packages -eq $null)
    {
        echo "No provisioned apps match the specified filter."
        exit
    }
    else
    {
        echo "Registering the provisioned apps that match $PackageFilter"
    }
}

ForEach($Package in $Packages)
{
    # get package name & path
    $PackageName = $Package | Get-ItemProperty | Select-Object -ExpandProperty PSChildName
    $PackagePath = [System.Environment]::ExpandEnvironmentVariables(($Package | Get-ItemProperty | Select-Object -ExpandProperty Path))

    # register the package    
    echo "Attempting to register package: $PackageName"

    Add-AppxPackage -register $PackagePath -DisableDevelopmentMode
}

 

windows 10 重新安装 默认软件

标签:var   输入   match   dna   cut   出现   where   粘贴   string   

原文地址:https://www.cnblogs.com/bearcarl/p/8530385.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!