Reputation: 95
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'.
I found it here: https://www.microsoft.com/en-us/download/details.aspx?id=36433
Thanks
Upvotes: 1
Views: 1832
Reputation: 202088
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;
Upvotes: 2