Advertisement
Guest User

a bat to ckeck LO install path

a guest
Mar 17th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.91 KB | None | 0 0
  1. setlocal ENABLEEXTENSIONS
  2.  
  3. call :QueryRegistry "HKEY_LOCAL_MACHINE\SOFTWARE\LibreOffice\UNO\InstallPath" ""
  4.  
  5. if not defined Value (
  6.     call :QueryRegistry "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\LibreOffice\UNO\InstallPath" ""
  7. )
  8.  
  9. echo %Value%
  10.  
  11. exit /B %ERRORLEVEL%
  12.  
  13. :: A function for querying registry value; return is in %Value%
  14. :QueryRegistry
  15. :: chcp 1252 makes REG QUERY to print its output in English. This makes the string look like:
  16. ::     (Default)    REG_SZ    C:\Program Files\LibreOffice 5\program
  17. :: Without this, the string may (e.g. for Russian locale) look like:
  18. ::     (По умолчанию)    REG_SZ    C:\Program Files\LibreOffice 5\program
  19. :: Notice the space in the (По умолчанию). This space makes additional token, and thus
  20. :: the batch becomes non-portable.
  21. set Value=
  22. chcp 1252
  23. for /F "usebackq tokens=2,*" %%A in (`REG QUERY %1 /v %2 2^>nul`) do (
  24.     set Value=%%B
  25. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement