Advertisement
aveyo

CS2_crashes.bat

Oct 19th, 2023 (edited)
1,454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.10 KB | Gaming | 0 0
  1. @(set '(=)||' <# hybrid script, can paste into powershell console #> @'
  2.  
  3. @echo off & title CS2 crash files export || by AveYo, 2023.10.19
  4. echo  Exporting CS2 crash files, grouped by date
  5.  
  6. :: detect STEAM path
  7. for /f "tokens=2*" %%R in ('reg query HKCU\SOFTWARE\Valve\Steam /v SteamPath 2^>nul') do set "steam_reg=%%S"
  8. for %%S in ("%steam_reg%") do set "STEAM=%%~fS"
  9.  
  10. :: detect CS2 path
  11. set CS2=& set lib=& for /f usebackq^ delims^=^"^ tokens^=4 %%s in (`findstr /c:":\\" "%STEAM%\steamapps\libraryfolders.vdf"`) do (
  12.   if exist "%%s\steamapps\appmanifest_730.acf" (
  13.     if exist "%%s\steamapps\common\Counter-Strike Global Offensive\game\core\pak01_dir.vpk" set "lib=%%s"))
  14. if defined lib set "STEAMAPPS=%lib:\\=\%\steamapps" & set "CS2=%lib:\\=\%\steamapps\common\Counter-Strike Global Offensive"
  15.  
  16. :: prepare OUT path
  17. set "OUT=%~dp0CS2_crashes" & set id=tbd
  18. if exist "%OUT%\*.zip" echo;& echo  Previously exported files are in: %OUT%
  19. mkdir "%OUT%" >nul 2>nul  
  20. setlocal enabledelayedexpansion
  21.  
  22. :: export CS2 mdmp files from Steam - Library - CS2 - Properties - Installed files - Browse > game\bin\win64
  23. pushd "%CS2%\game\bin\win64"
  24. echo;& echo  %CD% :
  25. for /f "tokens=1-9 delims=_" %%A in ('dir *.mdmp /a:-D/b/oD') do if %%B_%%C neq !id! (
  26.   set "id=%%B_%%C" & set "dmp=*!id!*.mdmp" & set "zip=%OUT%\cs2_crash_!id:_=!.zip" & echo  - !zip!
  27.   powershell -nop -c Compress-Archive $env:dmp $env:zip -CompressionLevel Optimal -Update
  28.   if exist "!zip!" del /f /q !dmp! >nul 2>nul
  29. )
  30.  
  31. :: export CS2 dmp files from Steam\dumps
  32. pushd "%STEAM%\dumps"
  33. echo;& echo  %CD% :
  34. for /f "tokens=1-9 delims=_" %%A in ('dir *cs2.exe*.dmp /a:-D/b/oD') do set C=%%C& set C=!C:~0,8!& if !C! neq !id! (
  35.   set "id=!C!" & set "dmp=*cs2.exe*!id!*.dmp" & set "zip=%OUT%\cs2_crash_!id!.zip" & echo  - !zip!
  36.   powershell -nop -c Compress-Archive $env:dmp $env:zip -CompressionLevel Optimal -Update
  37.   if exist "!zip!" del /f /q !dmp! >nul 2>nul
  38. )
  39.  
  40. :: done
  41. endlocal
  42. timeout /t -1 & exit /b
  43.  
  44. '@); $0=[Environment]::GetFolderPath('Desktop')+'\CS2_crashes.bat';${(=)||}-split"\r?\n"|out-file $0 -encoding default -force;& $0
  45. # press enter
  46.  
Tags: cs2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement