Delphi中如何用程序设置环境变量?

Icebird 2001-04-24 11:03:00
我用过API函数SetEnvironmentVariable,但却没有成功,请问有没有更好的方法
...全文
211 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
pipai 2001-04-30
  • 打赏
  • 举报
回复
BOOL SetEnvVariable(LPSTR szName, LPSTR szValue, CMO cmo);

SetEnvVariable sets the specified environment variable to a certain value. The environment variable can also be elongated by specifying the command option flag fAppend or fPrepend. Under Windows NT, the environment variables affected are the ones specified in the registry. Under Windows 95, autoexec.bat is modified to set the values.

Arguments

szName

Specifies the name of the environment variable.

szValue

Specifies the new value that you want to associate with the environment variable.

cmo

Specifies the command option flag. You can use fOverwrite, fAppend, or fPrepend.

Return Value

If the function succeeds, it returns fTrue.
If the function fails, it returns fFalse.

See Also

RemoveEnvVariable
Kingron 2001-04-29
  • 打赏
  • 举报
回复
//faint,没有这个函数?
Kingron 2001-04-29
  • 打赏
  • 举报
回复
设置SetEnvironmentVariable只是对当前进程起作用!SetEnvVariable才是全局的。
Icebird 2001-04-29
  • 打赏
  • 举报
回复
再次请教!
BCB 2001-04-24
  • 打赏
  • 举报
回复
可能设置的是局部的,一退出就没了

5,927

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧