Hack Forums
[Shell] How Do I Turn A Normal Variable Into A Enviromental Variable? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] How Do I Turn A Normal Variable Into A Enviromental Variable? (/showthread.php?tid=4477628)



How Do I Turn A Normal Variable Into A Enviromental Variable? - 'Palladium - Oct 5, 2014

Hey guys i need help this time i need help on how to turn a normal variable into a enviromental variable?


* - White Light - Oct 5, 2014

Why do you need to use an environment variable? Generally speaking, that's for something making permanent changes to a system, such as adding a directory to the %path% variable.


* - 'Palladium - Oct 5, 2014

White Light, the reason is because i am curious and keen to learn and know so please tell me.


* - G T X - Oct 6, 2014

I guess you could change an existing environmental variable by simply using the set command.. "Set PATH=%PATH%;%location_to_add%".

But, I'm not sure how one would set an environmental variable. Brb google.

Edit: try "setx /?"


* - Greenp0ison - Oct 6, 2014

Syntax for standard usage is as follows:

Defining an environment variable in the local user's environment:
Code
SETX <variable> <value>
SETX myname Greenp0ins

Defining an environment variable in the global environment:
Code
SETX <variable> <value> /M
SETX myname Greenp0ions /M

That should help.


* - 'Palladium - Oct 6, 2014

Hey GreenPosion thanks now i know how to set a normal variable as a enviromental variable! Thanks as well GTX!