See also:
- Creating INI file and adding strings to it
- Reading and setting Environment variables
- Storing environment strings in cursor
DECLARE INTEGER ExpandEnvironmentStrings IN kernel32;
STRING lpSrc,;
STRING @ lpDst,;
INTEGER nSize
? "COMPSPEC=", getVar ("%comspec%")
? "COMPUTERNAME=", getVar ("%computername%")
? "USERDOMAIN=", getVar ("%userdomain%")
? "USERNAME=", getVar ("%username%")
? "USERPROFILE=", getVar ("%userprofile%")
? "SYSTEMROOT=", getVar ("%systemroot%")
? "TEMP=", getVar ("%temp%")
? "TMP=", getVar ("%tmp%")
? "PATH=", getVar ("%path%")
FUNCTION getVar (lcVarname)
LOCAL lnBufferSize, lcResult
lnBufferSize = 2048
lcResult = SPACE(lnBufferSize)
lnResult = ExpandEnvironmentStrings (lcVarname, @lcResult, lnBufferSize)
RETURN IIF(lnResult > 0, LEFT(lcResult, AT(Chr(0), lcResult)-1), "#nothing#") If there is no corresponding environment variable, this function returns the input parameter unchanged.
Home