Is there a way to set the environment path programmatically in C++ on Windows?

后端 未结 5 1259
野的像风
野的像风 2020-12-08 16:24

Is there a way to set the global windows path environment variable programmatically (C++)?

As far as I can see, putenv sets it only for the current application.

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 17:00

    There is no API - changing the registry is the way to do it. The changed value will be used for processes starting after the change was made.

    Also: Notice that running applications must actively process the settings changed message and many (most?) do not do so.

提交回复
热议问题