I am trying to use command \i 'C:\Users\Public\person.sql'; on windows on psql. And it says C:UsersPublicperson.sql: No such file or directory Although file does exist. I tried to relocate file on different locations by I get the same answer. Is there any idea why it doesn't work?

  • 1
    Clearly you need to escape backslashes.
    – mustaccio
    Jul 18, 2021 at 13:00
  • 1
    The error message indicates why it didn't work. Notice the lack of backslashes? Your backslashes got eaten by psql, consumed in protecting characters that didn't need to be protected, and not passed on to the filename.
    – jjanes
    Jul 18, 2021 at 16:01

1 Answer 1


Use forward slashes:

\i c:/Users/Public/person.sql

Not the answer you're looking for? Browse other questions tagged or ask your own question.