M
M
Maxim Pritchin2017-11-18 10:56:21
cmd/bat
Maxim Pritchin, 2017-11-18 10:56:21

How to transfer resources to a folder with an installed program?

How to implement the transfer of resources to the program folder if I do not know where it is installed?
Is there any universal api for windows to get where the program is installed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2017-11-18
@pritchin_maxim1

Universal API - search for the program's executable file on all disks.
You should start scanning by scanning the standard installation directory: %systemdrive%\program files\<program name>
But often programs write some information to the registry during installation, often they write the installation path there as well. As a rule, the path in the registry is set hard in the program code. If your program does something similar, then you can determine its position by reading the corresponding key from the registry.
Sometimes you can find out the installation location by other indirect signs, for example, the program is written to the PATH environment variable, etc.
In addition, the Windows installer also writes something to the registry for each installed program, at least it accurately stores information on how to uninstall the program, google where the installer stores its entries in the registry and look for the uninstaller there, determine the installation path from it.
PS: and with tags in somehow decide on better.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question