If all you are going to do is substitute environment variables into a URI why not just identify the environment variables that psql uses directly, set those, and call "psql" directly.
select * from abc;
This is executing with default 5432 port.If postgres is installed to any other port then port option need to be include here[Don't want to take port from .pgpass file].
You couldn't even if you wanted to. Did you maybe mean the .pg_service.conf file?
You should strongly consider using .pgpass instead of "$PASSWORD" - especially depending upon where perform the export.