Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to programmatically get the Computer Name
Message
De
16/12/2007 15:27:22
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01275848
Message ID:
01276187
Vues:
24
>>IMO even simpler is
>>? GetEnv("COMPUTERNAME")
>>

>>
>>I would have to agree with you there < s >.
>>
>>I never thibk of GetEnv() anymore because, as the help file says:
>>
>>Returns the contents of the specified MS-DOS environment variable.
>
>Information for the PC without UDF's ;o)))
>
>? GETENV("ALLUSERSPROFILE")
>? GETENV("APPDATA")
>? GETENV("CommonProgramFiles")
>? GETENV("ComSpec")
>? GETENV("HOMEDRIVE")
>? GETENV("HOMEPATH")
>? GETENV("NUMBER_OF_PROCESSORS")
>? GETENV("Path")
>? GETENV("PROCESSOR_IDENTIFIER")
>? GETENV("ProgramFiles")
>? GETENV("SystemRoot")
>? GETENV("USERNAME")
>*** ...
>
If you are at all security-conscious you shouldn't use the environment variables. They can easily be manipulated either by a batch or shell process prior to your app starting, or globally for the whole user session by creating a new user environment variable with the same name: My Computer...Properties...Advanced...Environment Variables

In contrast, SYS( 0 ) always returns the correct computer name regardless of what happens to the environment variables.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform