![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | creating Environment variable during logon script Hello I am trying to create an environment variable that executes during the logon script , I can get it to create the variable during execution however , when I go to the cmd prompt and type SET the environment variable is not present. below is the subscript that I am calling from the main logon script Dim WSHShell Set WSHShell = WScript.CreateObject("WScript.Shell") 'WScript.Echo "The current PATH is " & _ ' WSHShell.Environment.item("path") 'WScript.Echo "Creating a new environment variable called SAPLOGON_INI_FILE" ' this variable will exist only during execution ' time of this script (Win95) WSHShell.Environment.item("SAPLOGON_INI_FILE") = "\\ca-mir-data01\Nss\SAPlogon\saplogon.all" wScript.Echo "SAPLOGON_INI_FILE is " & _ WSHShell.Environment.item("SAPLOGON_INI_FILE") Set WSHShell = Nothing |
My System Specs![]() |
| | #2 (permalink) |
| | Re: creating Environment variable during logon script "Elgordo" <Elgordo@xxxxxx> wrote in message news:521596E0-978E-4139-8446-8AC66F3C5784@xxxxxx Quote: > Hello > I am trying to create an environment variable that executes during the > logon > script , I can get it to create the variable during execution however , > when > I go to the cmd prompt and type SET the environment variable is not > present. > below is the subscript that I am calling from the main logon script > > Dim WSHShell > Set WSHShell = WScript.CreateObject("WScript.Shell") > > 'WScript.Echo "The current PATH is " & _ > ' WSHShell.Environment.item("path") > > 'WScript.Echo "Creating a new environment variable called > SAPLOGON_INI_FILE" > ' this variable will exist only during execution > ' time of this script (Win95) > WSHShell.Environment.item("SAPLOGON_INI_FILE") = > "\\ca-mir-data01\Nss\SAPlogon\saplogon.all" > wScript.Echo "SAPLOGON_INI_FILE is " & _ > WSHShell.Environment.item("SAPLOGON_INI_FILE") > > Set WSHShell = Nothing - Use setx.exe (Windows Resource Kit) - Use setenv.exe (ftp://barnyard.syr.edu/pub/vefatica/setenv.exe) - Modify the script below (from a post by Ruediger Roesler) Set oWsShell = CreateObject("WScript.Shell") For Each strEnv In Array("PROCESS", "SYSTEM", "USER", "VOLATILE") WScript.Echo VbCrLf & VbCrLf & strEnv & "-Environment:" & VbCrLf For Each str In oWsShell.Environment(strEnv) WScript.Echo str Next Next str = WScript.ScriptName Set oWshUEnv = oWsShell.Environment("User") WScript.Echo VbCrLf WScript.Echo "Create variable '" & str & "' in Environment 'User':" oWshUEnv(str) = CStr(Date) WScript.Echo VbCrLf & str & ": " & oWshUEnv(str) oWshUEnv.Remove str If Len(oWshUEnv(str)) = 0 Then WScript.Echo "Environment variable '" & str & "' was removed." Else WScript.Echo "Environment variable '" & str & "' wasn't removed." End If |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Creating logon scripts - the script will map different sets of drivesdepending on the security grp the user is in. | VB Script | |||
| environment variable not seen | Software | |||
| Call PS Script with Environment Variable in Path via Command Line | PowerShell | |||
| how to set environment variable where name is not a-z nor A-Z | PowerShell | |||
| how to set environment variable where name is not a-z nor A-Z | PowerShell | |||