devineresse 发表于 2010-3-24 10:33:40

谁能帮我把这段批处理改成au3的,非常感谢呀。(已解决)

本帖最后由 devineresse 于 2010-3-25 15:09 编辑

@echo off

REM PostgreSQL server psql runner script for Windows
REM Dave Page, EnterpriseDB

SET server=localhost
SET /P server="Server [%server%]: "

SET database=postgres
SET /P database="Database [%database%]: "

SET port=5432
SET /P port="Port [%port%]: "

SET username=postgres
SET /P username="Username [%username%]: "

for /f "delims=" %%a in ('chcp ^|find /c "932"') do @ SET CLIENTENCODING_JP=%%a
if "%CLIENTENCODING_JP%"=="1" SET PGCLIENTENCODING=SJIS
if "%CLIENTENCODING_JP%"=="1" SET /P PGCLIENTENCODING="Client Encoding [%PGCLIENTENCODING%]: "

REM Run psql
"C:\Program Files\PostgreSQL\8.4\bin\psql.exe" -h %server% -U %username% -d %database% -p %port%

pause

devineresse 发表于 2010-3-24 10:36:01

以上是数据库连接用的,我无法用au3直接连接postgres数据库,但是这个数据库自带的批处理可以,我想给它改成au3的。

另外如果能通过想问一下,如何通过au3连接postgresql并且进行查询。

bob 发表于 2010-3-24 16:11:55

最关键一句

C:\Program Files\PostgreSQL\8.4\bin\psql.exe" -h %server% -U %username% -d %database% -p %port%

l4ever 发表于 2010-3-24 17:24:58

Global $server=InputBox("Server", "type your server address", "localhost", "",200, 100)
Global $database =InputBox("database", "type your database name", "postgres", "",200, 100)
Global $port=InputBox("port", "type your sql port", "5432", "",200, 100)
Global $username=InputBox("user", "type your username", "123", "",200, 100)
Run("C:\Program Files\PostgreSQL\8.4\bin\psql.exe"&" -h "&$server&" -u "&$username&" -d "&$database&" -p "&$port)

masterpcc 发表于 2010-3-24 20:47:50

谢谢分享!!

devineresse 发表于 2010-3-25 15:08:58

回复 4# l4ever


   谢谢啊14ever,这么一看就明白是什么意思了。太感谢了,我马上试试。
页: [1]
查看完整版本: 谁能帮我把这段批处理改成au3的,非常感谢呀。(已解决)