How to print current working directory in psql console?
I am shocked that no one answered the question directly in over 2 years. Everyone assumes that because you are using postgres that you must be running Linux. Well, postgres is now becoming a very popular DBMS on Windows 10.
In Windows 10, in a psql command prompt type "! dir" to print the current working directory.
To change directories in the Windows 10 psql client, "\cd /users/yourlogin".
The psql client is a unix shell running on Windows, so it is a mix of unix and dos syntax commands.
Typing in the command \! pwd
will print the current working directory in psql.
To change working directory use command \cd <path>
; replace <path>
with desired path. Eg. Running command \cd /run/mount
will change the current working directory to /run/mount
. Try changing the your working directory to that containing the file which you want to run and then use \i
meta command as you did earlier. It will definitely work.