This uses the inbuilt compilers in Windows 10 - there are three VB.NET compilers and three C# compilers - just copy each text file into the same folder and double click the batch file to make the program.
REM Two files followREM ListEnvironment.bat
REM This file compiles ListEnvironment.vb to ListEnvironment.exe using the system VB.NET compiler.
REM List System, User, Volatile, and the resultant Process environmental variables that programs use.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc "%~dp0\ListEnvironment.vb" /out:"%~dp0\ListEnvironment.exe" /target:exe
REM To use
REM ListEnvironment
pause
-----------------------------------------------------------------------------------------
'ListEnvironment.vb
Imports System.Runtime.InteropServices
Public Module ListEnvironment
Public Sub Main ()
Dim WshShell As Object
Dim wshsysEnv As ObJect
Dim S As Object
WshShell = CreateObject("WScript.Shell")
wshsysEnv = WshShell.Environment("SYSTEM")
console.writeline(vbCrLf & "--------")
console.writeline("System")
console.writeline("--------")
For Each S In wshsysEnv
console.writeline(S)
Next
console.writeline(" ")
wshsysEnv = WshShell.Environment("Volatile")
console.writeline("--------")
console.writeline("Volatile - These are set at logon")
console.writeline("--------")
For Each S In wshsysEnv
console.writeline(S)
Next
console.writeline(" ")
wshsysEnv = WshShell.Environment("User")
console.writeline("--------")
console.writeline("User - These override system variables, and in the case of PATH are added to the system PATH")
console.writeline("--------")
For Each S In wshsysEnv
console.writeline(S)
Next
console.writeline(" ")
wshsysEnv = WshShell.Environment("Process")
console.writeline("--------")
console.writeline("Process - This is the combined environment from the above for the program")
console.writeline(" Variables starting with an equals sign, such as =C:=C:\Windows are internal CMD variables")
console.writeline(" CMD simulates a default directory per drive like MSDos. This is how it keeps track")
console.writeline("--------")
For Each S In wshsysEnv
console.writeline(S)
Next
console.writeline(" ")
console.writeline("--------")
console.writeline("Dynamic - These are updated each time they are used")
console.writeline("--------")
console.writeline("CD")
console.writeline("DATE")
console.writeline("TIME")
console.writeline("RANDOM")
console.writeline("ERRORLEVEL")
console.writeline("CMDEXTVERSION")
console.writeline("CMDCMDLINE")
console.writeline("HIGHESTNUMANODENUMBER")
End Sub
End Module
Public Module ListEnvironment
Public Sub Main ()
Dim WshShell As Object
Dim wshsysEnv As ObJect
Dim S As Object
WshShell = CreateObject("WScript.Shell")
wshsysEnv = WshShell.Environment("SYSTEM")
console.writeline(vbCrLf & "--------")
console.writeline("System")
console.writeline("--------")
For Each S In wshsysEnv
console.writeline(S)
Next
console.writeline(" ")
wshsysEnv = WshShell.Environment("Volatile")
console.writeline("--------")
console.writeline("Volatile - These are set at logon")
console.writeline("--------")
For Each S In wshsysEnv
console.writeline(S)
Next
console.writeline(" ")
wshsysEnv = WshShell.Environment("User")
console.writeline("--------")
console.writeline("User - These override system variables, and in the case of PATH are added to the system PATH")
console.writeline("--------")
For Each S In wshsysEnv
console.writeline(S)
Next
console.writeline(" ")
wshsysEnv = WshShell.Environment("Process")
console.writeline("--------")
console.writeline("Process - This is the combined environment from the above for the program")
console.writeline(" Variables starting with an equals sign, such as =C:=C:\Windows are internal CMD variables")
console.writeline(" CMD simulates a default directory per drive like MSDos. This is how it keeps track")
console.writeline("--------")
For Each S In wshsysEnv
console.writeline(S)
Next
console.writeline(" ")
console.writeline("--------")
console.writeline("Dynamic - These are updated each time they are used")
console.writeline("--------")
console.writeline("CD")
console.writeline("DATE")
console.writeline("TIME")
console.writeline("RANDOM")
console.writeline("ERRORLEVEL")
console.writeline("CMDEXTVERSION")
console.writeline("CMDCMDLINE")
console.writeline("HIGHESTNUMANODENUMBER")
End Sub
End Module
No comments:
Post a Comment