Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @(set ^ "0=%~f0" -d ' .bat or .ps1 script ) & powershell -nop -c . ([scriptblock]::Create((gc $env:0)-join \"`n\")) & exit /b ')
- "`n CLEAR SHADER CACHE `n" # AveYo, 17.05.2024 Never use the preview text from pastebin! click copy, raw or download
- $run = {
- # AveYo: detect STEAM and specific APPS
- $steam = resolve-path (gpv "HKCU:\SOFTWARE\Valve\Steam" SteamPath)
- $apps = @{id = 730; name='cs2'; root='Counter-Strike Global Offensive'; game='csgo'},
- @{id = 570; name='dota2'; root='dota 2 beta'; game='dota'}
- gc "$steam\steamapps\libraryfolders.vdf" |foreach {$_ -split '"',5} |where {$_ -like '*:\\*'} |foreach {
- $l = resolve-path $_; $apps |foreach { if (test-path "$l\steamapps\appmanifest_$($_.id).acf") { $_.lib = "$l\steamapps"
- $game = "$($_.lib)\common\$($_.root)\game"; $_.exe = "$game\bin\win64\$($_.name).exe"; $_.path = "$game\$($_.game)"
- }}}
- "`n close STEAM and APPS "
- $apps |foreach { if (ps -name $_.name -ea 0) {"$($_.name) is running..."; kill -name $_.name -force} }
- if (ps -name 'steam' -ea 0) {"Steam is running..."; start "$steam\Steam.exe" -args '-shutdown' -wait; sleep 5 }
- "`n empty STEAM logs "
- mkdir "$steam\logs\-EMPTY-" -force >''; robocopy "$steam\logs\-EMPTY-/" "$STEAM\logs/" /MIR /R:1 /W:0 /ZB >''
- "`n empty STEAM crash dumps "
- mkdir "$steam\dumps\-EMPTY-" -force >''; robocopy "$steam\dumps\-EMPTY-/" "$STEAM\dumps/" /MIR /R:1 /W:0 /ZB >''
- "`n empty APPS crash dumps "
- $apps |foreach { if ($_.exe) { del "$(split-path $_.exe)\*.mdmp" -force } }
- "`n empty APPS shadercache "
- $apps |foreach { $t = @("$($_.path)\shadercache", "$($_.lib)\shadercache\$($_.id)")
- if ($_.lib -ne "$steam\steamapps") { $t += "$steam\steamapps\shadercache\$($_.id)" } ; $t |foreach { if (test-path $_) {
- "$_"; mkdir "$_\-EMPTY-" -force >''; robocopy "$_\-EMPTY-/" "$_/" /MIR /R:1 /W:0 /ZB >''
- }}}
- "`n empty Compute cache "
- $t = "$([Environment]::GetFolderPath('ApplicationData'))\NVIDIA\ComputeCache"; if (test-path $t) {
- $t; mkdir "$t\-EMPTY-" -force >''; robocopy "$t\-EMPTY-/" "$t/" /MIR /R:1 /W:0 /ZB >''
- }
- "`n empty NV cache "
- $t = "$([Environment]::GetFolderPath('CommonApplicationData'))\NVIDIA Corporation\NV_Cache"; if (test-path $t) {
- $t; mkdir "$t\-EMPTY-" -force >''; robocopy "$t\-EMPTY-/" "$t/" /MIR /R:1 /W:0 /ZB >''
- }
- "`n empty Local shader cache "
- 'D3DSCache','NVIDIA\GLCache','NVIDIA\DXCache','NVIDIA\OptixCache','NVIDIA Corporation\NV_Cache',
- 'AMD\DX9Cache','AMD\DxCache','AMD\DxcCache','AMD\GLCache','AMD\OglCache','AMD\VkCache','Intel\ShaderCache' |foreach {
- $t = "$([Environment]::GetFolderPath('LocalApplicationData'))\$_"; if (test-path $t) {
- $t; mkdir "$t\-EMPTY-" -force >''; robocopy "$t\-EMPTY-/" "$t/" /MIR /R:1 /W:0 /ZB >''
- }}
- "`n empty LocalLow shader cache "
- 'NVIDIA\PerDriverVersion\DXCache','NVIDIA\PerDriverVersion\GLCache','Intel\ShaderCache' |foreach {
- $t = "$(split-path ([Environment]::GetFolderPath('LocalApplicationData')))\LocalLow\$_"; if (test-path $t) {
- $t; mkdir "$t\-EMPTY-" -force >''; robocopy "$t\-EMPTY-/" "$t/" /MIR /R:1 /W:0 /ZB >''
- }}
- "`n empty driver temp "
- "$env:systemdrive\AMD","$env:systemdrive\NVIDIA","$env:systemdrive\Intel" |foreach { if (test-path $_) {
- mkdir "$_\-EMPTY-" -force >''; robocopy "$_\-EMPTY-/" "$_/" /MIR /R:1 /W:0 /ZB >''
- }}
- timeout -1
- }
- sp HKCU:\Console\cmd ScreenColors 0x0b -type Dword -ea 0; sp HKCU:\Console\cmd QuickEdit 0 -type Dword -ea 0
- # AveYo: $run elevated
- if ([Security.Principal.WindowsIdentity]::GetCurrent().Groups.Value -notcontains 'S-1-5-32-544') {
- write-host " Requesting ADMIN rights.. " -fore Black -back Yellow; sleep 2; $_="$env:temp\runas.Admin"; sc $_ $run -force -ea 0
- start cmd -args "/x /d /r start `"cmd`" powershell -nop -c . ([scriptblock]::Create((gc \`"$_\`")-join \`"``n\`"))" -verb runas
- } else { . $run }
- $_press_enter_if_copy_pasted_to_powershell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement