|
-
Mar 29th, 2000, 03:05 PM
#1
Thread Starter
Lively Member
ok folks - here it is: i am looking for a list of all the possible variables to be used with the Environ$("String") function. does anyone know a website where these are listed? or can anyone help direct me to a place where i might find information about this function? thanks a lot for all your help.
Michael
-
Mar 29th, 2000, 03:38 PM
#2
Maybe you can find your info at the Microdudes Developer Network site. Ok i know it sometimes sucks, this site.
But it also provide sometimes the info we need.
http:\\msdn.microsoft.com.
But here i have some information about the Environ function.
/* ====================================================================
Returns the String associated with an operating system environment variable.
Syntax
Environ({envstring | number})
The Environ function syntax has thesenamed arguments:
Part Description
envstring Optional.String expression containing the name of an environment variable.
number Optional.Numeric expression corresponding to the numeric order of the environment string in the environment-string table. The numberargument can be any numeric expression, but is rounded to a whole number before it is evaluated.
Remarks
If envstring can't be found in the environment-string table, a zero-length string ("") is returned. Otherwise, Environ returns the text assigned to the specified envstring; that is, the text following the equal sign (=) in the environment-string table for that environment variable.
If you specify number, the string occupying that numeric position in the environment-string table is returned. In this case, Environ returns all of the text, including envstring. If there is no environment string in the specified position, Environ returns a zero-length string.
/* ====================================================================
Example:
Code:
Dim EnvString, Indx, Msg, PathLen ' Declare variables.
Indx = 1 ' Initialize index to 1.
Do
EnvString = Environ(Indx) ' Get environment
' variable.
If Left(EnvString, 5) = "PATH=" Then ' Check PATH entry.
PathLen = Len(Environ("PATH")) ' Get length.
Msg = "PATH entry = " & Indx & " and length = " & PathLen
Exit Do
Else
Indx = Indx + 1 ' Not PATH entry,
End If ' so increment.
Loop Until EnvString = ""
If PathLen > 0 Then
MsgBox Msg ' Display message.
Else
MsgBox "No PATH environment variable exists."
End If
Goodluck.. 
-Kayoca Mortation
-
Mar 29th, 2000, 04:21 PM
#3
Thread Starter
Lively Member
thanks. i found that too on MSDN. it simply told me how to use it, which i know how to do. what i am looking for is a list of strings to use with the Environ$ function. for instance, in the above example you see Envorin$("PATH"). i want to know what other things i can use besides PATH. make sense? thanks a lot guys. and thanks to you kayoca. take care.
michael
-
Mar 29th, 2000, 06:16 PM
#4
Lively Member
I think this is what you are after.
Code:
Dim EnvString As String
Dim Indx As Integer
Dim myNewEnvironString As String
Indx = 1 ' Initialize index to 1.
Do
EnvString = Environ(Indx)
If Environ(Indx) <> "" Then
'Search for the = character and read the left
'section of the string.
myNewEnvironString = Left(Environ(Indx), InStr(1, EnvString, "=") - 1)
'Display the Environ Name
Debug.Print myNewEnvironString
Indx = Indx + 1 'Increment the index by 1
End If
Loop Until EnvString = ""
-
Mar 29th, 2000, 06:23 PM
#5
Thread Starter
Lively Member
thank you so very much ishmael. that's exactly what i was looking for. that's so great. thank you thank you thank you. ok...i'm done.
-
Mar 10th, 2011, 12:58 PM
#6
New Member
Re: Environ$ (Simplest method I know)
Use the "set" command at a command prompt! 
Detailed Instructions:- Open a Command Prompt window
By default there is a shortcut in the start menu:
- Vista/Win7: "Start -> All Programs -> Accessories"
- Windows 95,98,XP "Classic Start Menu": "Start -> Programs -> Accessories"
- At the prompt, type "set" and press the 'Enter' or 'Return' key
- Let your eyes feast upon the glory that is all of the available options for environment variables (and their respective values)
-
Mar 10th, 2011, 02:01 PM
#7
Re: Environ$
There is no complete list because users can define new ones any time they want.
Be wary of user environment variables for many purposes like locating directories. These can be altered to false values whenever the user wants to.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|