ExpandEnvironmentStrings Method

 

Description

 

Returns an environment variable's expanded value.

 

PowerBASIC Syntax

 

PROPERTY GET ExpandEnvironmentStrings ( _

BYVAL bstrSrc AS STRING _

) AS STRING

 

Arguments

 

bstrSrc

BSTR. The name of the environment variable you want to expand.

 

Return Value

 

BSTR. The environment variable's expanded value.

 

Remarks

 

The ExpandEnvironmentStrings method expands environment variables defined in the PROCESS environment space only. Environment variable names, which must be enclosed between "%" characters, are not case-sensitive.

 

Example [PowerBASIC]

 

#INCLUDE "WSHOM.INC"

 

' Creates an instance of the Windows Script Host

DIM pWsh AS IWshShell

pWsh = NEWCOM "WScript.Shell"

 

' The following code expands the Windows Directory

' environment variable and displays it:

DIM outStr AS STRING

outStr = pWsh.ExpandEnvironmentStrings(UCODE$("%WinDir%"))

STDOUT ACODE$(outStr)

 

Valid XHTML 1.0 Transitional