Last active
December 26, 2019 00:28
-
-
Save cornzz/7d7e99f02fac7ace6859fd8c07a8ccd6 to your computer and use it in GitHub Desktop.
Nvidia post-update cleaning PS script - Run with 'PowerShell.exe -ExecutionPolicy Bypass -File .\nvidia_update_cleaner.ps1'
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
# PowerShell.exe -ExecutionPolicy Bypass -File .\nvidia-update-cleaner.ps1 | |
Write-Host 'This script is going to clean up old Nvidia installer files.'; | |
Write-Host 'Press any key to continue...'; | |
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); | |
$paths = ('C:\Program Files\NVIDIA Corporation\Installer2\'), ('C:\ProgramData\NVIDIA Corporation\Downloader\'); | |
$total = 0; | |
foreach ($path in $paths) | |
{ | |
Write-Host 'Clearing ' $path ' ...'; | |
$total += (gci $path -Recurse -Force | measure Length -s).Sum; | |
gci -Path $path | Foreach-Object {Remove-Item $_.FullName -Recurse}; # Todo: change this so parent folder stays | |
} | |
'Cleanup finished! Cleared {0:N3} GB. Press any key to exit...' -f ($total / 1GB); | |
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment