Jump to content

Recommended Posts

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
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 by dummzeuch

Share this post


Link to post

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 by miab

Share this post


Link to post
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 by Remy Lebeau
  • Like 2

Share this post


Link to post

Thanks, that should be enough for me.

Edited by miab

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×