How do you get the currently logon user's name in the command line. I know there is a way, but forgot
. It's a variable / command / something....
Getting username in cmd
for windows:
echo %username%
for un*x:
whoami
echo %username%
for un*x:
whoami
Owh...as easy as that. Thanks.
You can also learn other global system variables by typing set on the command prompt.
e.g.
C:\set [press ENTER]
e.g.
C:\set [press ENTER]
Also, there is a graphical interface to view/set environment variables.
Control Panel -> System -> Advanced -> Enviroment Variables...
System Variables are available for every user;
User Variables are available for just the current user.
Control Panel -> System -> Advanced -> Enviroment Variables...
System Variables are available for every user;
User Variables are available for just the current user.
