I use $ENV{USERNAME} because it works on Unix and on Windows, IME. $ENV{LOGNAME} is probably the oldest one on the Unix side and so may be the most widely supported. You can even use something like $ENV{LOGNAME} || $ENV{USERNAME} || $ENV{USER} (assuming you don't let anybody have a username of "0").
Of course, if you are worried about preventing people from pretending to be somebody else, then you shouldn't rely on an environment variable.
- tye
In reply to Re: What is the best way to find username running your script? (Windows)
by tye
in thread What is the best way to find username running your script?
by dr.jekyllandme
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |