環境変数の取得 <TOP>
環境変数文字列は、どういうものがあるか判らなかったので、VisualBasicにて確認しdataとしています。
文字通り環境により変わります。
VisualBasicでの取得コード
Private Sub Command1_Click()
Dim
i As Long
For
i = 1 To 29
List1.AddItem i & Environ(i)
Next
End Sub
WindowsXP
Windows98
Windows2000
'================================================================ '= 環境変数取得(ENVIRON$("環境変数文字列") '================================================================ #include "Windows.bi" Var Shared MAINFORM As Object Var Shared LIST1 As Object MAINFORM.ATTACH GETHWND LIST1.ATTACH GETDLGITEM("LIST1") LIST1.SETFONTNAME "MS ゴシック" LIST1.SETFONTSIZE 14 '================================================================ '= '================================================================ Declare Sub MAINFORM_START edecl () Sub MAINFORM_START() MAINFORM.SETWINDOWTEXT "Environ$で取得できる環境変数" Var KH$(29) As String For I = 1 To 29 read KH$(I) Next LIST1.RESETCONTENT For I = 1 To 29 LIST1.ADDSTRING Format$(I,"##:") & Format$(KH$(I),"& &:") & environ$(KH$(I)) Next '-------------------- data ALLUSER data ALLUSERSPROFILE data APPDATA data CLIENTNAME data CommonProgramFiles data COMPUTERNAME data ComSpec data FP_NO_HOST_CHECK data HOMEDRIVE data HOMEPATH data LOGONSERVER data NUMBER_OF_PROCESSORS data OS data Path data PATHEXT data PROCESSOR_ARCHITECTURE data PROCESSOR_IDENTIFIER data PROCESSOR_LEVEL data PROCESSOR_REVISION data ProgramFiles data SESSIONNAME data SystemDrive data SystemRoot data TEMP data TMP data USERDOMAIN data USERNAME data USERPROFILE data WINDIR End Sub '================================================================ '= '================================================================ While 1 WaitEvent Wend Stop End