miab 25 Posted May 6, 2020 How to add / extend the system PATH only while the Delphi Windows application is running (only for the needs of this application)? Share this post Link to post
dummzeuch 1505 Posted May 6, 2020 (edited) 18 minutes ago, miab said: How to add / extend the system PATH only while the Delphi Windows application is running (only for the needs of this application)? I'm assuming with "Delphi Windows application" you mean the IDE: Create a batch file that adds to the path, and then starts the IDE (and exits so the console window closes). If you don't want a batch file (many people complain about the "ugly console window"): Write a program that creates a new environment variable block and pass that when executing the IDE. Edited May 6, 2020 by dummzeuch Share this post Link to post
Anders Melander 1783 Posted May 6, 2020 Tools > Options > Environment Options > Environment Variables Share this post Link to post
miab 25 Posted May 6, 2020 (edited) No, I do not mean Delphi IDE. I would like the application to add to the current system PATH some directory that it saw would be through it during its execution. For example, directory with additional dll-s. Edited May 6, 2020 by miab Share this post Link to post
Remy Lebeau 1394 Posted May 6, 2020 (edited) 20 minutes ago, miab said: No, I do not mean Delphi IDE. I would like the application to add to the current system PATH some directory that it saw would be through it during its execution. SetEnvironmentVariable() updates the environment of the calling process only, changes are not persisted when the process exits. Quote For example, directory with additional dll-s. You don't need to update the PATH to handle that. Use SetDllDirectory() or AddDllDirectory() instead. Edited May 6, 2020 by Remy Lebeau 2 Share this post Link to post
David Heffernan 2345 Posted May 6, 2020 If possible you should use side by side assemblies Share this post Link to post
Guest Posted May 6, 2020 https://docs.microsoft.com/en-gb/windows/win32/procthread/environment-variables Share this post Link to post
miab 25 Posted May 6, 2020 (edited) Thanks, that should be enough for me. Edited May 6, 2020 by miab Share this post Link to post