pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feed.bat file to access postgreSQL command line from C:\ Dos prompt
4+ messages / 3 participants
[nested] [flat]
* .bat file to access postgreSQL command line from C:\ Dos prompt
@ 2006-12-09 01:00 Philippe Salama <karebacnyc@yahoo.com>
2006-12-09 01:11 ` Re: .bat file to access postgreSQL command line from C:\ Dos prompt Richard Broersma Jr <rabroersma@yahoo.com>
2006-12-09 01:32 ` Re: .bat file to access postgreSQL command line from C:\ Dos prompt Philippe Salama <karebacnyc@yahoo.com>
0 siblings, 2 replies; 4+ messages in thread
From: Philippe Salama @ 2006-12-09 01:00 UTC (permalink / raw)
To: pgsql-admin
Thanks for your help! And thanks to your help, I was able to figure out the following, as a psql.bat file on drive C:
cd program files
cd postgreSQL
cd 8.1
cd bin
psql -U postgres template1
I could not figure out how to make a path work in the .bat file if there is a space in PROGRAM FILES. But it words if I just to a CD to each directory.
I have a paperback on PostgreSQL in which most of the exercises use the command line prompt. Although I have found admin programs that allow me to access PostgreSQL nicely, I want to learn about the command line.
I also have a 1984 book on SQL by Lantimes, and I put all the exercise tables int o MySQL. Then, I exported the tables to an SQL script, and modified the script so that it would run in PostgreSQL. If anyone is interested, I can provide that script.
I would also like to go through the some of Joe Celko's books, like SQL for Smarties, and I plan to put the test tables into PostgreSQL and also MySQL.
But if anyone has any test tables from SQL instruction books, let me know.
I will be happy to share what I have with others if there is some interest.
I feel that if the test data for such SQL exercises is made available on the Internet, then it will encourage more people to learn SQL.
---------------------------------
Check out the all-new Yahoo! Mail beta - Fire up a more powerful email and get things done faster.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: .bat file to access postgreSQL command line from C:\ Dos prompt
2006-12-09 01:00 .bat file to access postgreSQL command line from C:\ Dos prompt Philippe Salama <karebacnyc@yahoo.com>
@ 2006-12-09 01:11 ` Richard Broersma Jr <rabroersma@yahoo.com>
1 sibling, 0 replies; 4+ messages in thread
From: Richard Broersma Jr @ 2006-12-09 01:11 UTC (permalink / raw)
To: Philippe Salama <karebacnyc@yahoo.com>; pgsql-admin
> But if anyone has any test tables from SQL instruction books, let me know.
>
> I will be happy to share what I have with others if there is some interest.
>
> I feel that if the test data for such SQL exercises is made available on the Internet, then it
> will encourage more people to learn SQL.
I have some test table that I created from the SQL puzzles and answers book. However, I didn't
not develop test for each exercise since sample data wasn't provided.
Regards,
Richard Broersma Jr.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: .bat file to access postgreSQL command line from C:\ Dos prompt
2006-12-09 01:00 .bat file to access postgreSQL command line from C:\ Dos prompt Philippe Salama <karebacnyc@yahoo.com>
@ 2006-12-09 01:32 ` Philippe Salama <karebacnyc@yahoo.com>
2006-12-09 01:49 ` Re: .bat file to access postgreSQL command line from C:\ Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Salama @ 2006-12-09 01:32 UTC (permalink / raw)
To: pgsql-admin
Here is a refinement of my psql.bat file that I just received from a senior member at utteracces.com
cd "\program files"
cd postgreSQL
cd 8.1
cd bin
psql -U postgres template1
---------------------------------
You could shorten this to
Code:
---------------------------------
cd "\Program Files\postgreSQL\8.1\bin"
psql -U postgres template1
---------------------------------
You also might want to ensure that the user is "on" the correct drive (most likely this is the C: drive). If so:
Code:
---------------------------------
c:
cd "\Program Files\postgreSQL\8.1\bin"
psql -U postgres template1
---------------------------------
And if you don't want any echoing of the commands to the command window (wouldn't be necessary if this is used in a shortcut or other non-console situation):
Code:
---------------------------------
@echo off
c:
cd "\Program Files\postgreSQL\8.1\bin"
psql -U postgres template1
---------------------------------
And, here is my reply:
For a long time, I did not know how to use notepad to save something with a suffix other than .txt
and then someone showed me that if you "psql.bat" , and choose allfiles type, then it will save with the .bat ending.
Before I learned that, I used to save as .txt, then go to the dos prompt and say REN *.TXT *.BAT (in a folder which has only my .txt file).
It also helped me to fine a freeware text editor called pspad which helps a lot with such tasks, as well as html and php.
Philippe Salama <karebacnyc@yahoo.com> wrote: Thanks for your help! And thanks to your help, I was able to figure out the following, as a psql.bat file on drive C:
cd program files
cd postgreSQL
cd 8.1
cd bin
psql -U postgres template1
I could not figure out how to make a path work in the .bat file if there is a space in PROGRAM FILES. But it words if I just to a CD to each directory.
I have a paperback on PostgreSQL in which most of the exercises use the command line prompt. Although I have found admin programs that allow me to access PostgreSQL nicely, I want to learn about the command line.
I also have a 1984 book on SQL by Lantimes, and I put all the exercise tables int o MySQL. Then, I exported the tables to an SQL script, and modified the script so that it would run in PostgreSQL. If anyone is interested, I can provide that script.
I would also like to go through the some of Joe Celko's books, like SQL for Smarties, and I plan to put the test tables into PostgreSQL and also MySQL.
But if anyone has any test tables from SQL instruction books, let me know.
I will be happy to share what I have with others if there is some interest.
I feel that if the test data for such SQL exercises is made available on the Internet, then it will encourage more people to learn SQL.
---------------------------------
Check out the all-new Yahoo! Mail beta - Fire up a more powerful email and get things done faster.
---------------------------------
Want to start your own business? Learn how on Yahoo! Small Business.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: .bat file to access postgreSQL command line from C:\
2006-12-09 01:00 .bat file to access postgreSQL command line from C:\ Dos prompt Philippe Salama <karebacnyc@yahoo.com>
2006-12-09 01:32 ` Re: .bat file to access postgreSQL command line from C:\ Dos prompt Philippe Salama <karebacnyc@yahoo.com>
@ 2006-12-09 01:49 ` Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shellam (Mailing Lists) @ 2006-12-09 01:49 UTC (permalink / raw)
To: pgsql-admin
>
> ------------------------------------------------------------------------
>
> For a long time, I did not know how to use notepad to save something
> with a suffix other than .txt
> and then someone showed me that if you "psql.bat" , and choose
> allfiles type, then it will save with the .bat ending.
Or, when you go to Save As in Notepad, wrap the filename in quotes, e.g.
File > Save As > "pgsql.bat"
This will tell Notepad that you've already added the extension and don't
need .txt adding on as well.
--
Andy Shellam
NetServe Support Team
the Mail Network
"an alternative in a standardised world"
p: +44 (0) 121 288 0832/0839
m: +44 (0) 7818 000834
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2006-12-09 01:49 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-12-09 01:00 .bat file to access postgreSQL command line from C:\ Dos prompt Philippe Salama <karebacnyc@yahoo.com>
2006-12-09 01:11 ` Richard Broersma Jr <rabroersma@yahoo.com>
2006-12-09 01:32 ` Philippe Salama <karebacnyc@yahoo.com>
2006-12-09 01:49 ` Re: .bat file to access postgreSQL command line from C:\ Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox