Here is the code
Can anyone else confirm this issue or point out if I'm doing something incorrect?
Code: Select all
getenvvar>path,VarResult
messagemodal>%varresult%
Moderators: JRL, Dorian (MJT support)
Code: Select all
getenvvar>path,VarResult
messagemodal>%varresult%
Code: Select all
D:\Programs\Cisco\Unified Communications Manager Attendant Console\jre1.4\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;d:\Programs\IBM\CLIENT~1;d:\Programs\IBM\CLIENT~1\Shared;d:\Programs\IBM\CLIENT~1\Emulator;d:\code
Hi Marcus,tbrahmer wrote:I've run the same two lines and get nothing back as well.
I'm running Windows 7 (32 bit however) and MS 12.0.5.
I can retrieve other environment variables (OS, ComSpec, PathExt ...) but for some reason, not PATH - just comes back blank.
Code: Select all
GetEnvVar>Path,VarResult
MDL>%VarResult%
Try this....or an alternative way to get this value from within MS
Code: Select all
RegistryReadKey>HKEY_LOCAL_MACHINE,SYSTEM\CurrentControlSet\Control\Session Manager\Environment,Path,var
MDL>Var
Code: Select all
GetEnvVar>Path,VarResult
MDL>%VarResult%
I can't explain why the GetEnvVar> function does not get the path variable value. But I do know that he "Path" variable has always been the odd duck of the common environment variables. As far as I know its the only one that has its own DOS command. If you type "Temp" at a command line you don't get a proper response.And either way, I'd still like to know why this simple command does not work for path:
"alternative method"? Funny how many perfectly good ANSWERS I've provided here that get called "Work arounds". Of course, now that I've said that, this "answer" will probably get blown out of the water.Thanks, your alternative method does work, but is it possible that a program changes the Path environment variable and does not update that registry entry? If so then it is important to be able to pull what the Path environment variable is set to "now" verses what is stored in the registry.
Code: Select all
VBSTART
Function GetEnvVar(varname)
Set oShell = CreateObject( "WScript.Shell" )
GetEnvVar=oShell.ExpandEnvironmentStrings(varname)
End Function
VBEND
VBEVal>GetEnvVar("%PATH%"),strPath
Code: Select all
Let>buffer_SIZE=10000
LibFunc>Kernel32,GetEnvironmentVariableA,gev,PATH,str:buffer,1024
MessageModal>gev_2
GetEnvVar>path,test
mdl>test
Code: Select all
IfFileExists>%temp_dir%env_var_list.txt
DeleteFile>%temp_dir%env_var_list.txt
EndIf
IfFileExists>%temp_dir%GetEnvVar_list.txt
DeleteFile>%temp_dir%GetEnvVar_list.txt
EndIf
Let>rp_wait=1
Let>rp_windowmode=0
Run>cmd /c set > %temp_dir%env_var_list.txt
ReadFile>%temp_dir%env_var_list.txt,data
Separate>data,%CRLF%,line
DeleteFile>%temp_dir%env_var_list.txt
Let>kk=0
Repeat>kk
add>kk,1
Let>value=line_%kk%
Separate>value,=,var
GetEnvVar>%var_1%,Env_Var
WriteLn>%temp_dir%GetEnvVar_list.txt,wres,%var_1%%tab%=%tab%%Env_Var%
Until>kk=%line_count%
ReadFile>%temp_dir%GetEnvVar_list.txt,data
MDL>data
DeleteFile>%temp_dir%GetEnvVar_list.txt
ALLUSERSPROFILE = C:\Documents and Settings\All Users
APPDATA = C:\Documents and Settings\dickl\Application Data
CLASSPATH = .;C:\Program Files\Java\jre6\lib\ext\QTJava.zip
CommonProgramFiles = C:\Program Files\Common Files
COMPUTERNAME = DELL014
ComSpec = C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK = NO
HOMEDRIVE = C:
HOMEPATH = \Documents and Settings\dickl
LOGONSERVER = \\DELL014
NUMBER_OF_PROCESSORS = 2
OS = Windows_NT
Path =
PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE = x86
PROCESSOR_IDENTIFIER = x86 Family 6 Model 23 Stepping 6, GenuineIntel
PROCESSOR_LEVEL = 6
PROCESSOR_REVISION = 1706
ProgramFiles = C:\Program Files
PROMPT =
SESSIONNAME = Console
SystemDrive = C:
SystemRoot = C:\WINDOWS
TEMP = C:\DOCUME~1\dickl\LOCALS~1\Temp
TMP = C:\DOCUME~1\dickl\LOCALS~1\Temp
USERDOMAIN = DELL014
USERNAME = dickl
USERPROFILE = C:\Documents and Settings\dickl
windir = C:\WINDOWS
windir = C:\WINDOWS
Code: Select all
VBSTART
Function GetEnvVar(varname)
Set oShell = CreateObject( "WScript.Shell" )
GetEnvVar=oShell.ExpandEnvironmentStrings(varname)
End Function
VBEND
//Thx Marcus
VBEVal>GetEnvVar("%PATH%"),path_via_VBScript_function_call
//Thx JRL
RegistryReadKey>HKEY_LOCAL_MACHINE,SYSTEM\CurrentControlSet\Control\Session Manager\Environment,Path,path_via_registry_read
MDL>These two methods return different data for Path:%CRLF%%CRLF%via read of Registry:%CRLF%Path = %path_via_registry_read%%CRLF%%CRLF%via VBScript function:%CRLF%Path = %path_via_VBScript_function_call%
So for my purposes, I'll be using the VBScript method of getting the Path... until GetEnvVar> can be made to work...above script on my PC wrote:These two methods return different data for Path:
via read of Registry:
Path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Windows Imaging\;C:\ORACLE\Ora92\bin;C:\SVC;C:\progra~1\ibm\cicsun~1\bin;C:\Program Files\Microsoft Application Virtualization Client;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files\Intel\DMIX;C:\progra~1\e!oc
via VBScript function:
Path = C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Windows Imaging\;C:\ORACLE\Ora92\bin;C:\SVC;C:\progra~1\ibm\cicsun~1\bin;C:\Program Files\Microsoft Application Virtualization Client;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files\Intel\DMIX;C:\progra~1\e!oc;C:\Program Files\IDM Computer Solutions\UEStudio\