Thread: password error in batch script
Hi,
I have a password Vl=SO*CIz%A83FQF that is working fine like that in the command prompt but when it is being used in a batch file it is giving me an error of wrong password, the password is something looks like that in batch script.
set "PGPASSWORD=Vl=SO*CIz%A83FQF"
Could you please help me in getting this password read by command prompt in the batch file.
Regards.
On 7/27/23 1:17 PM, Atul Kumar wrote: > Hi, > > I have a password Vl=SO*CIz%A83FQF that is working fine like that in the > command prompt but when it is being used in a batch file it is giving me > an error of wrong password, the password is something looks like that in > batch script. > > set "PGPASSWORD=Vl=SO*CIz%A83FQF" More information needed. 1) What sort of batch script; shell, Python, etc? 2) OS and version. 3) What is set pointing at? 4) PGPASSWORD is an environment variable per: https://www.postgresql.org/docs/15/libpq-envars.html So I would expect export PGPASSWORD = . 5) Why not use pgpass?: https://www.postgresql.org/docs/current/libpq-pgpass.html > > Could you please help me in getting this password read by command prompt > in the batch file. > > > > Regards. -- Adrian Klaver adrian.klaver@aklaver.com
On 7/27/23 16:45, Adrian Klaver wrote: > On 7/27/23 1:17 PM, Atul Kumar wrote: >> Hi, >> >> I have a password Vl=SO*CIz%A83FQF that is working fine like that in the >> command prompt but when it is being used in a batch file it is giving me >> an error of wrong password, the password is something looks like that in >> batch script. >> >> set "PGPASSWORD=Vl=SO*CIz%A83FQF" Also, the first double quote seems to be in the wrong position. This is the canonical way to define a string: set PGPASSWORD="Vl=SO*CIz%A83FQF" > > More information needed. > > 1) What sort of batch script; shell, Python, etc? > > 2) OS and version. > > 3) What is set pointing at? > > 4) PGPASSWORD is an environment variable per: > > https://www.postgresql.org/docs/15/libpq-envars.html > > So I would expect export PGPASSWORD = . > > 5) Why not use pgpass?: > > https://www.postgresql.org/docs/current/libpq-pgpass.html > >> >> Could you please help me in getting this password read by command prompt >> in the batch file. >> >> >> >> Regards. > > -- Born in Arizona, moved to Babylonia.