@echo off
for /f "tokens=4" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-9.2" /v "Base Directory"') do ( set pgPath=%%i) @echo %pgPath%