Last active
September 5, 2017 11:30
-
-
Save ml4den/25f13bff6d666c1fbc78b705d3c57f7c to your computer and use it in GitHub Desktop.
Close/Quit Application Window with PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple find and quit: | |
(New-Object -comObject Shell.Application).Windows() | where-object {$_.LocationName -eq "Personalisation"} | foreach-object {$_.quit()} | |
# Credit: https://www.tenforums.com/customization/51260-apply-windows-10-theme-cmd-powershell-programming-post963151.html#post963151 | |
# Wait for window and quit: | |
do { | |
$windowcheck = (New-Object -comObject Shell.Application).Windows() | where-object {$_.LocationName -eq "Personalization"} | |
Write-Host "Waiting for window..." | |
Start-Sleep -m 200 | |
} | |
until ($windowcheck.LocationName -eq "Personalization") | |
# The loop has ended; closing the window... | |
$windowcheck | foreach-object {$_.quit()} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment