View Full Version : Select valid path from multiple paths searched by system search

12-06-2016, 09:16 AM

I am trying to find location of sqlcmd file on computer. It is installed as part of the Sql installation. There can be multiple sql servers instalelled on machine. I want any one of them for my use.

Location of the path is stored at example location stated below. This path changes from version to version.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100\Tools\ClientSetup\path

Another way is to search for registry key ODBCToolsPath which can vary from product to product.


is there any way to search full registry hive ....\Microsoft\microsoft sql server\.......

I want to select the first path searched in this registry key which is valid and use in custom action for running a custom action.

Is there any elegant way to do this ?