如何检查 SQLCMD.EXE 是否安装在 Inno Setup 的客户端上

How can I check SQLCMD.EXE if it is installed on client in Inno Setup

我正在为 Inno Setup 安装程序编写脚本,我希望我的脚本检查客户端是否具有工具 SQLCMD.EXE

我不知道该怎么做,是否有任何脚本可以检查例如注册表并告诉客户端它没有安装; msgBox 'Do you want to install them from Microsoft Site?'

我找到了这个但是没有用

if RegQueryStringValue(
  HKLM, 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Client SDK\ODBC0\Tools\Binn'.

我在这里找到它:https://www.microsoft.com/en-us/download/details.aspx?id=36433

谢谢

sqlcmd.exe 路径由 SQL 服务器安装程序放入搜索路径 (PATH) 中。 .

因此,只需在 PATH 中搜索 sqlcmd.exe:

if FileSearch('sqlcmd.exe', GetEnv('PATH')) = '' then
begin
  if MsgBox('Install SQL server?', mbConfirmation, MB_YESNO) = IDYES then
  begin
    { Install here }
  end;
end;