Search notes:

VBScript: Environment variables

The following example tries to demonstrate how the values of environment variables.
option explicit

dim wsh
set wsh = createObject("wScript.shell")

dim userEnv
dim systemEnv
dim processEnv
dim volatileEnv

set userEnv     = wsh.environment("user"    )
set systemEnv   = wsh.environment("system"  )
set processEnv  = wsh.environment("process" )
set volatileEnv = wsh.environment("volatile")

wscript.echo("user's temp  = " & userEnv   ("temp"        ))
wscript.echo("systemRoot   = " & systemEnv ("os"          ))
wscript.echo("computername = " & processEnv("computername"))

'
'  Expand strings that contain %VARNAME%:
'
wScript.echo(wsh.expandEnvironmentStrings("temp         = %temp%"))

wscript.echo()
wscript.echo("Volatile variables:")
dim varName
for each varName in volatileEnv
    wScript.echo("  " & varName)
next
Github repository about-VBScript, path: /examples/environments.vbs

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758200705, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/VBScript/examples/environments(65): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78