dcandygmailcom

Lists System, User, Volatile, and the resulant Process envir

Feb 10th, 2019
192
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM Two files follow
  2. REM ListEnvironment.bat
  3. REM This file compiles ListEnvironment.vb to ListEnvironment.exe using the system VB.NET compiler.
  4. REM Lists System, User, Volatile, and the resulant Process environmental variables
  5. C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc "%~dp0\ListEnvironment.vb" /out:"%~dp0\ListEnvironment.exe" /target:exe
  6. REM To use
  7. REM ListEnvironment
  8. pause
  9.  
  10.  
  11. ------------------------------------------------------
  12.  
  13.  
  14. 'ListEnvironment.vb
  15. Imports System.Runtime.InteropServices
  16. Public Module ListEnvironment
  17.     Public Sub Main ()
  18.         Dim WshShell As Object
  19.         Dim wshsysEnv As ObJect
  20.         Dim S As Object
  21.         WshShell = CreateObject("WScript.Shell")
  22.  
  23.         wshsysEnv = WshShell.Environment("SYSTEM")
  24.         console.writeline(vbCrLf & "--------")
  25.         console.writeline("System")
  26.         console.writeline("--------")
  27.         For Each S In wshsysEnv
  28.             console.writeline(S)
  29.         Next
  30.  
  31.         console.writeline(" ")
  32.         wshsysEnv = WshShell.Environment("Volatile")
  33.         console.writeline("--------")
  34.         console.writeline("Volatile - These are set at logon")
  35.         console.writeline("--------")
  36.         For Each S In wshsysEnv
  37.             console.writeline(S)
  38.         Next
  39.  
  40.         console.writeline(" ")
  41.         wshsysEnv = WshShell.Environment("User")
  42.         console.writeline("--------")
  43.         console.writeline("User - These override system variables, and in the case of PATH are added to the system PATH")
  44.         console.writeline("--------")
  45.         For Each S In wshsysEnv
  46.             console.writeline(S)
  47.         Next
  48.  
  49.         console.writeline(" ")
  50.         wshsysEnv = WshShell.Environment("Process")
  51.         console.writeline("--------")
  52.         console.writeline("Process - This is the combined environment from the above for the program")
  53.         console.writeline("          Variables starting with an equals sign, such as =C:=C:\Windows are internal CMD variables")
  54.         console.writeline("          CMD simulates a default directory per drive like MSDos. This is how it keeps track")
  55.         console.writeline("--------")
  56.         For Each S In wshsysEnv
  57.             console.writeline(S)
  58.         Next
  59.  
  60.         console.writeline(" ")
  61.         console.writeline("--------")
  62.         console.writeline("Dynamic - These are updated each time they are used")
  63.         console.writeline("--------")
  64.         console.writeline("CD")
  65.         console.writeline("DATE")
  66.         console.writeline("TIME")
  67.         console.writeline("RANDOM")
  68.         console.writeline("ERRORLEVEL")
  69.         console.writeline("CMDEXTVERSION")
  70.         console.writeline("CMDCMDLINE")
  71.         console.writeline("HIGHESTNUMANODENUMBER")
  72.     End Sub
  73. End Module
RAW Paste Data