Andree_H
Andree_H

Reputation: 51

php set user environment using cli on windows

I am trying to set a user environment variable, but couldn't find a solution to achieve this. I am able to read a user environment variable with:

$WshShell = new COM("WScript.Shell");
$WshEnv = $WshShell->Environment("USER");
$tempPath = $WshEnv->Item("TEMP");

But how can I set a variable if I would like to use COM at php?

Upvotes: 1

Views: 74

Answers (1)

Theodore R. Smith
Theodore R. Smith

Reputation: 23259

You would use the putenv('VARIABLE=value') function.

Upvotes: 1

Related Questions