SetEnv Function (String, String, Logic) | |
Update or replace the contents of a DOS environment variable.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION SetEnv(
cVar AS STRING,
cValue AS STRING,
lAppend AS LOGIC
) AS LOGIC
public static bool SetEnv(
string cVar,
string cValue,
bool lAppend
)
Request Example
View SourceParameters
- cVar
- Type: String
The environment variable to be modified. - cValue
- Type: String
The new value to assign to the environment variable. - lAppend
- Type: Logic
Logical value indicating whether the new value should be appended to the old value (TRUE) or if it should replace the old value (FALSE).
Return Value
Type:
Logic
TRUE if successful; otherwise FALSE.
Remarks
SetEnv() lets you either append or replace a DOS environment variable from within an application. Typically this is configuration information-- including path names--that describes the location of files (database, index, label, or reports).
Note: Instead of using environment variables for configuring your application, you may want to consider using registry settings.
Examples
These examples modify the DOS PATH:
1? SetEnv("PATH","D:\CAVO2x\BIN", .F.)
2? GetEnv("PATH")
3? SetEnv("PATH", "C:\MyApp", .T.)
4? GetEnv("PATH")
See Also