Search notes:

VBA: Windows Script Host

Programatically adding the reference to the Windows Script Host object model (C:\Windows\SysWOW64\wshom.ocs) to a VBA project:
thisWorkbook.VBProject.references.addFromGuid _
        GUID   :="{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}" , _
        major  :=  1                                      , _
        minor  :=  0

Show environment variables

The following scriptlet shows environment variables:
option explicit

sub wsh_environments() ' {

    dim wsh     as new wshShell

    showEnv wsh, "User"     ' Values as stored in the Registry under HKCU\Environment
    showEnv wsh, "System"   ' Values as stored in the Registry under HKLM\System\CurrentControlSet\Control\Session Manager\Environment
    showEnv wsh, "Volatile" '
    showEnv wsh, "Process"  '

end sub ' }

sub showEnv(wsh as wshShell, env as string) ' {

    debug.print "Show values for environment " & env

    dim envItem as variant
    for each envItem in wsh.environment(env)
      '
      ' envItem is NAME=VALUE, for example
      ' TEMP=%USERPROFILE%\AppData\Local\Temp
      '
        debug.print "  " & envItem
    next envItem

end sub ' }
Github repository about-VBA, path: /object-libraries/windows-script-host/environment.bas

TODO

This page should probably be merged with WSH

See also

Don't confuse wScript.shell with shell.application (Shell Automation Service).
Useful object libraries

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...', 1758187655, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/VBA/Useful-object-libraries/Windows-Script-Host/index(81): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78