![](/img/trans.png)
[英]Powershell is running at startup but not executing Remove-AppxPackage
[英]How to Create Powershell Script Remove-appxpackage Windows Built-in App Executed by Batch Command?
有人可以確認此腳本正確嗎?
批處理cmd Execute.bat:
@echo off
color d
echo Execute Powershell Script With Administrative Privileges
echo.
PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dpn0.ps1""' -Verb RunAs}"
echo.
timeout /t 5
對於Powerhsell.ps1:
Remove-appxpackage Microsoft.XboxApp_5.6.17000.0_x64__8wekyb3d8bbwe
Remove-appxpackage Microsoft.XboxGameCallableUI_1000.10240.16384.0_neutral_neutral_cw5n1h2txyewy
Remove-appxpackage Microsoft.XboxIdentityProvider_1000.10240.16384.0_neutral_neutral_cw5n1h2txyewy
Remove-appxpackage Windows.ContactSupport_10.0.10240.16384_neutral_neutral_cw5n1h2txyewy
Remove-appxpackage Microsoft.BingNews_4.3.193.0_x86__8wekyb3d8bbwe
Remove-appxpackage Microsoft.BingFinance_4.3.193.0_x86__8wekyb3d8bbwe
Remove-appxpackage Microsoft.BingWeather_4.3.193.0_x86__8wekyb3d8bbwe
Remove-appxpackage Microsoft.Getstarted_2.1.9.0_x64__8wekyb3d8bbwe
Remove-appxpackage Microsoft.SkypeApp_3.2.1.0_x86__kzf8qxf38zg5c
Remove-appxpackage Microsoft.WindowsPhone_10.1506.20010.0_x64__8wekyb3d8bbwe
Remove-appxpackage Microsoft.WindowsMaps_4.1505.50619.0_x64__8wekyb3d8bbwe
Remove-appxpackage Microsoft.People_1.10159.0.0_x64__8wekyb3d8bbwe
Remove-appxpackage Microsoft.Office.OneNote_17.4201.10091.0_x64__8wekyb3d8bbwe
Remove-appxpackage Microsoft.MicrosoftSolitaireCollection_3.1.6103.0_x64__8wekyb3d8bbwe
Remove-appxpackage Microsoft.MicrosoftOfficeHub_17.4218.23751.0_x64__8wekyb3d8bbwe
Remove-appxpackage Microsoft.BingSports_4.3.193.0_x86__8wekyb3d8bbwe
Remove-appxpackage Microsoft.Appconnector_1.3.3.0_neutral__8wekyb3d8bbwe
Remove-appxpackage Microsoft.3DBuilder_10.0.0.0_x64__8wekyb3d8bbwe
Remove-appxpackage microsoft.windowscommunicationsapps_17.6002.42251.0_x64__8wekyb3d8bbwe
以及如何在Powershell中增加等待時間?
是的,只要腳本正確且位置正確且與批處理文件同名,就可以正常工作。 我不確定為什么要在PowerShell中添加等待時間,但是要查找的cmdlet是start-sleep
您可以將包放在文本文件中,然后執行以下操作:
$packages = Get-Content c:\scripts\packages.txt
Foreach ($package in $packages){
Remove-appxpackage $package
Start-Sleep -Seconds 15 #change this as needed
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.