-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45391d3
commit 1a233e5
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
##### Windows CleanUp Script ##### | ||
##### Use if execution policy error: Set-ExecutionPolicy RemoteSigned ##### | ||
$objShell = New-Object -ComObject Shell.Application | ||
$objFolder = $objShell.Namespace(0xA) | ||
$WinTemp = "c:\Windows\Temp\*" | ||
|
||
#1# Empty Recycle Bin # | ||
write-Host "Emptying Recycle Bin." -ForegroundColor Cyan | ||
$objFolder.items() | %{ remove-item $_.path -Recurse -Confirm:$false} | ||
|
||
#2# Remove Temp | ||
write-Host "Removing Temp" -ForegroundColor Green | ||
Set-Location “C:\Windows\Temp” | ||
Remove-Item * -Recurse -Force -ErrorAction SilentlyContinue | ||
|
||
Set-Location “C:\Windows\Prefetch” | ||
Remove-Item * -Recurse -Force -ErrorAction SilentlyContinue | ||
|
||
Set-Location “C:\Documents and Settings” | ||
Remove-Item “.\*\Local Settings\temp\*” -Recurse -Force -ErrorAction SilentlyContinue | ||
|
||
Set-Location “C:\Users” | ||
Remove-Item “.\*\Appdata\Local\Temp\*” -Recurse -Force -ErrorAction SilentlyContinue | ||
|
||
#3# Running Disk Clean up Tool | ||
write-Host "Finally now , Running Windows disk Clean up Tool" -ForegroundColor Cyan | ||
cleanmgr /sagerun:1 | out-Null | ||
|
||
$([char]7) | ||
Sleep 3 | ||
write-Host "I finished the cleanup task,Bye Bye " -ForegroundColor Yellow | ||
Sleep 3 | ||
##### End of the Script ##### |