{"id":76001,"date":"2016-01-02T11:59:00","date_gmt":"2016-01-02T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/01\/02\/powertip-set-personal-environment-variable-from-powershell\/"},"modified":"2019-02-18T09:20:26","modified_gmt":"2019-02-18T16:20:26","slug":"powertip-set-personal-environment-variable-from-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-set-personal-environment-variable-from-powershell\/","title":{"rendered":"PowerTip: Set Personal Environment Variable from PowerShell"},"content":{"rendered":"<p><b>Summary<\/b>: Access the&nbsp;<b>$ENV<\/b>&nbsp;object in Windows PowerShell to alter personal environment settings.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;How can I use Windows PowerShell to change a system environment variable such as the user %TEMP%?<\/p>\n<p style=\"margin-left:30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>&nbsp;You can read any personal environment settings by using $ENV:VariableName, then assigning a value. <br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For example, to change your personal %TEMP% to a new location, use:<\/p>\n<p style=\"margin-left:120px\">$ENV:Temp=C:\\Foo<\/p>\n<p style=\"margin-left:60px\"><b>Note<\/b>&nbsp;This presumes C:\\Foo exists and will alter the variable for the present PowerShell session.<\/p>\n<p style=\"margin-left:30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7610.Dr.ScriptoForTips.jpg\" alt=\" \" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Access the&nbsp;$ENV&nbsp;object in Windows PowerShell to alter personal environment settings. &nbsp;How can I use Windows PowerShell to change a system environment variable such as the user %TEMP%? &nbsp;You can read any personal environment settings by using $ENV:VariableName, then assigning a value. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For example, to change your personal %TEMP% to [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[56,356,154,45],"class_list":["post-76001","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-guest-blogger","tag-powertip","tag-sean-kearney","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Access the&nbsp;$ENV&nbsp;object in Windows PowerShell to alter personal environment settings. &nbsp;How can I use Windows PowerShell to change a system environment variable such as the user %TEMP%? &nbsp;You can read any personal environment settings by using $ENV:VariableName, then assigning a value. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For example, to change your personal %TEMP% to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/76001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=76001"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/76001\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=76001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=76001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=76001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}