Hi,
Thank you for posting your query.
Kindly follow the steps provided below to resolve your query.
Please run this command and post the output here:
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
Go to this link for your reference and additional troubleshooting procedures https://answers.microsoft.com/en-us/windows/forum/all/postgresql-installation-error-the-environment/c48bc66c-8e90-442c-9478-68edd06b31da
If the answer is helpful kindly click "ACCEPT AS ANSWER" and up vote it.