0

I am looking for a way to temporarily change the user-specific PATH variable in Windows 7 in such a way that it resets when the user logs off.

Preferably I would like to accomplish this in a batch file, but if that's not possible then Python would be my next option, but either way I need to do this without admin privileges.

Is such a thing possible?

0

1 Answer 1

0

You can open a cmd prompt and type SET a=asdf but it will only be for that command prompt (it'd set an environment variable called 'a' with value 'asdf). If you open new command prompts or any other command prompt, it won't have the change.

The only other way, is permanent. And then you'd need to look into how to make a script run at log off that deletes those registry entries. You can use setx to make permanent changes, or commands to add to the registry(it's often worth checking the registry anyway if using setx, to make sure you did it right). Any permanent changes are stored in (for system variables) HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and for user variables HKCU\Environment and you'd then have to user the reg query or some other command to delete the name data pairs (names can be known as values), for those environment variables that you want to delete. There is a prompt when doing reg delete, so you can check that you're telling it to delete a key, or a 'value'(name).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .