system commands


anyone know what the system commands are for finding out who the current user is?
for Windows, linux and osx?



If I remember right it’s these:

Mac OSX:

who       Print all usernames currently logged on
whoami    Print the current user id and name (`id -un')

Windows XP:

WHOAMI   Output the current UserName and domain


who      Print all usernames currently logged in
whoami   Print the current user id and name (`id -un')

Being UNIX based, the OSX and Linux commands should be similar if not the same.

Good Luck!


hmmm, WHOAMI doesnt seem to work with a system command.

I was able to get what I wanted with system “%USERNAME%” though, so that works, will have to try the others at work tomorrow



Here’s where I found the information:
perhaps you can find something better suited for what your up to…


yup, thats exactly where I found it at.

Thanks for the help though, I will check the linux and osx commands tomorrow and see what they spit out.




Windows XP recognizes: SET USERNAME

if you just type in SET, you’ll get a whole buttload of interesting returns. Enjoy!


sweet, that helps even more. some info in set that I was already getting another way…thanks heaps for that one.



I love to help. However, if ya get bored and can shed any light on this one:

It’s got me real buggered up.



You guys know how to query the computer’s name? On a PC?

I need to have a script run only when it’s on the render server, not on a workstation, and all i need to get the script working is the ability to query the computer name.


you can get it by using the following:

string $queryName = `system("[b]set computername[/b]")`;
string $computerName[] = stringToStringArray( $queryName, "=");
print ("this computer's name is " + $computerName[1]);


set returns a bunch of fun stuff!


to get the username:
string $user = getenv user;

to get the computer name:
string $comp = getenv computername;


In Linux:

string $user = getenv USER



Actually it also works on windows.


yeah, thats why I said it in my post, right before yours. :wink:


Heh ! Only read the first message …


heh, yeah, i think we’re all guilty of that crime from time to time… :wink:










This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.