Skip to content

Instantly share code, notes, and snippets.

@jhorsman
Last active October 1, 2017 17:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhorsman/74b95217f195cd5f3fae to your computer and use it in GitHub Desktop.
Save jhorsman/74b95217f195cd5f3fae to your computer and use it in GitHub Desktop.
$t_path_7 = "C:\Users\$env:username\AppData\Local\Microsoft\Windows\Temporary Internet Files"
$c_path_7 = "C:\Users\$env:username\AppData\Local\Microsoft\Windows\Caches"
$d_path_7 = "C:\Users\$env:username\Downloads"
$temporary_path = Test-Path $t_path_7
$check_cashe = Test-Path $c_path_7
$check_download = Test-Path $d_path_7
if($temporary_path -eq $True -And $check_cashe -eq $True -And $check_download -eq $True)
{
echo "Clean history"
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
echo "Clean Temporary internet files"
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
(Remove-Item $t_path_7\* -Force -Recurse) 2> $null
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
echo "Clean Cache"
(Remove-Item $c_path_7\* -Force -Recurse) 2> $null
echo "Clean Downloads"
(Remove-Item $d_path_7\* -Force -Recurse) 2> $null
echo "Done"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment