Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setlocal ENABLEEXTENSIONS
- call :QueryRegistry "HKEY_LOCAL_MACHINE\SOFTWARE\LibreOffice\UNO\InstallPath" ""
- if not defined Value (
- call :QueryRegistry "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\LibreOffice\UNO\InstallPath" ""
- )
- echo %Value%
- exit /B %ERRORLEVEL%
- :: A function for querying registry value; return is in %Value%
- :QueryRegistry
- :: chcp 1252 makes REG QUERY to print its output in English. This makes the string look like:
- :: (Default) REG_SZ C:\Program Files\LibreOffice 5\program
- :: Without this, the string may (e.g. for Russian locale) look like:
- :: (По умолчанию) REG_SZ C:\Program Files\LibreOffice 5\program
- :: Notice the space in the (По умолчанию). This space makes additional token, and thus
- :: the batch becomes non-portable.
- set Value=
- chcp 1252
- for /F "usebackq tokens=2,*" %%A in (`REG QUERY %1 /v %2 2^>nul`) do (
- set Value=%%B
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement