cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Alex_W
Level 6

How best to find another app’s install dir?

I want to install and attach database files into the SQLExpress data directory as a work around to a directory permissions problem on XP SP2, (basically the SQLExpress service doesn’t have permission to write in my app’s install dir).
I can copy DB files into the directory I want and attach them. I know where to default directory location is and can test for it before copying.

My question is if the user has installed SQL Server/Express into a non-standard location pervious to running my installer, what's the best way to find the directory I want? Is using FindAllFiles(with some SQL default file) good enough or is there a better way?
Labels (1)
0 Kudos
(1) Reply
ma1achai
Level 3

I generally use the 'App Paths' registry key to find program install paths. For instance, I do not have sql express installed here, but I do have regular sqlserver.exe installed, and to find out where the exe is located I would check this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\sqlservr.exe\Path

Hope that helps...

-putman
0 Kudos