1

I am writing a script for Inno Setup installer and I want my script to check if the client has the tool SQLCMD.EXE or not.

I do not know how to do that, is there any script to check for example the registry and tell the client it is not installed ; the msgBox 'Do you want to install them from Microsoft Site?'

I found this but does not work

if RegQueryStringValue(
  HKLM, 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn'.
  • MySQL Version is 2014 &
  • Microsoft SQL Server Management Studio 12.0.2000.8

I found it here: https://www.microsoft.com/en-us/download/details.aspx?id=36433

Thanks

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Sandy Nomy
  • 87
  • 1
  • 10

1 Answers1

2

The sqlcmd.exe path is put into the search path (PATH) by the SQL server installer. You yourself rely on this in your code.

So, just search for the sqlcmd.exe in the PATH:

if FileSearch('sqlcmd.exe', GetEnv('PATH')) = '' then
begin
  if MsgBox('Install SQL server?', mbConfirmation, MB_YESNO) = IDYES then
  begin
    // Install here
  end;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992