system commands


#1

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

thanks
-todd


#2

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

Linux:

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!


#3

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

thanks
-todd


#4

Here’s where I found the information: http://www.ss64.com/
perhaps you can find something better suited for what your up to…


#5

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.

thanks
-todd


#6

GOT IT!

Windows XP recognizes: SET USERNAME

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


#7

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

-todd


#8

I love to help. However, if ya get bored and can shed any light on this one: http://www.cgtalk.com/showthread.php?t=216588

It’s got me real buggered up.

:twisted:


#9

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.


#10

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]);


#11

set returns a bunch of fun stuff!


#12

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

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


#13

In Linux:

string $user = getenv USER

Frank


#14

Actually it also works on windows.


#15

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


#16

Heh ! Only read the first message …


#17

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


#18

@@!
@
@!

@_@!

@_@!

@_@!

@_@!

@_@!

@_@!


#19

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.