Last active
March 24, 2022 10:01
-
-
Save joshjavier/045d7ec118dea2aabed3ca24c80e0072 to your computer and use it in GitHub Desktop.
PowerShell script for cleaning up Parsec files
This file contains 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
# Import a custom function to retry deleting a folder in case it's still locked | |
Invoke-Expression -Command (New-Object Net.WebClient).DownloadString("https://gist.github.com/PrateekKumarSingh/65afe12a3fda5ef9ba42bf0673026728/raw/423d55256c185b8f5be819b2e1ef1aa2391fad2e/Retry-Command.ps1") | |
# Clean up Parsec files | |
$ParsecDir = "$HOME\Downloads\parsec-portable" | |
$ParsecShortcut = "$HOME\Desktop\Parsec.lnk" | |
Stop-Process -Name "parsecd" | |
Retry-Command -ScriptBlock {Remove-Item $ParsecDir -Recurse} -TimeoutInSecs 3 -Verbose | |
Remove-Item $ParsecShortcut -ErrorAction Ignore | |
# Close PowerShell | |
Write-Host -NoNewLine "Removed all Parsec files. Press any key to exit..." | |
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | |
Stop-Process -Id $PID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment