Login | |
|
 |
RE: Enviroment Variables DONT WORK - 5/3/2007 10:10:02 PM
|
|
 |
|
| |
SAPIENScripter
Posts: 276
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
|
First of all, you shouldn't reuse an existing variable name like TEMP. If the desktop is running Win2000 or later you should use SYSTEM Set objShell = WScript.CreateObject("WScript.Shell") Set colUsrEnvVars = objShell.Environment("SYSTEM") colUsrEnvVars("myVar") = "Upgraded" Wscript.Echo colUsrEnvVars("myVar") You also won't see the new variable until you open a new CMD window.
_____________________________
Jeffery Hicks Windows PowerShell MVP SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com Follow Me: http://www.twitter.com/JeffHicks
|
|
| |
|
|
|
 |
RE: Enviroment Variables DONT WORK - 5/4/2007 12:46:10 AM
|
|
 |
|
| |
4scriptmoni
Posts: 208
Score: 0
Joined: 5/3/2007
Status: offline
|
temp was just a example. still if open a new cmd window i lose the purpose of what i was trying to do... i was passing a sys variable to a .exec cmd like: ("cmd /c logoff %sessionid% /server:" & servername ) but i have figured out another way. like: ("cmd /c logoff " & resultid & " /server:" & servername ) duhh.. thanks anyways for the post.
_____________________________
Enterprise Microsoft Scripts Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc... http://www.felipeferreira.net
|
|
| |
|
|
|
|
|