Faguss

Launch old TexView2

Jan 21st, 2023
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.64 KB | Software | 0 0
  1. @ECHO off
  2. REM Different versions of TexView2 share the same registry key for config path
  3. REM This script will launch the old TexView2 with its own config and then revert changes afterwards
  4.  
  5. REM Set path to the old TexView2 folder manually or leave it empty for auto-detect
  6. SET texview=
  7.  
  8.  
  9.  
  10. IF NOT "%texview%" == "" GOTO skipautodetect
  11.  
  12. REM Find old TexView2
  13. FOR /F "tokens=2* skip=2" %%a IN ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\TexView 2" /v UninstallString') DO SET texview=%%b
  14. IF "%texview%" == "" ECHO Couldn't find TexView2 && GOTO end
  15. SET texview=%texview:~0,-13%
  16.  
  17. :skipautodetect
  18. IF NOT "%texview:~-1%" == "\" SET texview=%texview%\
  19.  
  20.  
  21.  
  22. REM Backup the current TexView config path
  23. SET original_path=
  24. FOR /F "tokens=2* skip=2" %%a IN ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\BIStudio\TextureConvert /v configPath') DO SET original_path=%%b
  25. IF "%original_path%" == "" ECHO Can't find BIStudio\TextureConvert && GOTO end
  26.  
  27. REM Modifying the registry requires admin rights
  28. fsutil dirty query %systemdrive% >nul
  29. IF NOT %errorlevel% == 0 ECHO Right click on %~nx0 and select Run as administrator && GOTO end
  30.  
  31. ECHO Changing registry config path to %texview%TexConvert.cfg
  32. REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\BIStudio\TextureConvert" /v "configPath" /t REG_SZ /d "%texview%TexConvert.cfg" /f
  33. ECHO:
  34.  
  35. ECHO Launching TexView2. Waiting to finish
  36. "%texview%TexView2.exe"
  37. ECHO:
  38.  
  39. ECHO Bringing back path to %original_path%
  40. REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\BIStudio\TextureConvert" /v "configPath" /t REG_SZ /d "%original_path%" /f
  41.  
  42.  
  43.  
  44. :end
  45. ECHO:
  46. PAUSE
Tags: arma texview2
Add Comment
Please, Sign In to add comment