我正在工作的软件,需要psqlodbc驱动程序和Delphi9.0数据库,我们有一个安装程序设计使用postgresSQl 7来安装psqlodbc和postgreSQl 9静默地一个接一个地点击一个单一的按钮,在这里一切运行良好,但问题是在卸载期间,我想先卸载psqlodbc,然后postgreSQl 9也在一个单一的按钮点击。
我只想在postgreSQl卸载后使用shellpApi运行cmd.exe 9卸载程序,因为现在我正在检查'cmd.exe‘是否正在运行或没有启动postgreSQl卸载程序,但有时在卸载psqlodbc之后,'cmd.exe’仍然在postgreSQl卸载程序中无法执行。
所以任何请告诉我如何检查psqlodbc卸载过程是否完整。
这些文件是windows.exe 2.postgresql-9.0.2-1- 1.psqlodbc.msi
安装/卸载由bat文件处理
在高级版本中感谢:)
发布于 2011-12-10 12:37:15
我了解了如何检查psqlodbc是否已完全卸载,以便可以开始卸载postgres
为此,我找到了解决方案On stackoverflow itself
function TForm1.ExecAndWait(const CommandLine: string) : Boolean;
var
StartupInfo: Windows.TStartupInfo; // start-up info passed to process
ProcessInfo: Windows.TProcessInformation; // info about the process
ProcessExitCode: Windows.DWord; // process's exit code
begin
// Set default error result
Result := False;
// Initialise startup info structure to 0, and record length
FillChar(StartupInfo, SizeOf(StartupInfo), 0);
StartupInfo.cb := SizeOf(StartupInfo);
// Execute application commandline
if Windows.CreateProcess(nil, PChar(CommandLine),
nil, nil, False, 0, nil, nil,
StartupInfo, ProcessInfo) then
begin
try
// Now wait for application to complete
if Windows.WaitForSingleObject(ProcessInfo.hProcess, INFINITE)
= WAIT_OBJECT_0 then
// It's completed - get its exit code
if Windows.GetExitCodeProcess(ProcessInfo.hProcess,
ProcessExitCode) then
// Check exit code is zero => successful completion
if ProcessExitCode = 0 then
Result := True;
finally
// Tidy up
Windows.CloseHandle(ProcessInfo.hProcess);
Windows.CloseHandle(ProcessInfo.hThread);
end;
end;
end;所以第1步if ExecAndWait('msiexec /x C:\psqlodbc09\psqlodbc.msi') then begin //uninstall postgresNow...!! end;
发布于 2011-11-23 20:22:55
如果驱动程序可用,您可以检查注册表。安装完成后,您将获得:
c:\tmp\pg>reg query "hklm\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL ANSI"
! REG.EXE VERSION 3.0
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL ANSI
APILevel REG_SZ 1
ConnectFunctions REG_SZ YYN
Driver REG_SZ C:\Program Files\psqlODBC\0900\bin\psqlodbc30a.dll
DriverODBCVer REG_SZ 03.00
FileUsage REG_SZ 0
Setup REG_SZ C:\Program Files\psqlODBC\0900\bin\psqlodbc30a.dll
SQLLevel REG_SZ 1
UsageCount REG_DWORD 0x1当你卸载它时,你会得到(本地化版本):
c:\tmp\pg>reg query "hklm\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL ANSI"
Błąd: system nie może odnaleźć określonego klucza rejestru lub wartości.
c:\tmp\pg>(此菜单:错误:系统无法在注册表中找到项或值)
有关如何使用它以及可在批中使用的返回代码,请参阅:reg /?。
您还可以在HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall下搜索注册表卸载信息
https://stackoverflow.com/questions/8238632
复制相似问题