Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

windows user name? 1

Status
Not open for further replies.

ejhemler

Programmer
Aug 30, 2002
68
0
0
US
is there a command in vfp 6.0 that will tell you what you are logged in as on windows? thanks in advance.

erik
 
?SUBSTR(SYS(0),AT('#',SYS(0))+1)

Ali Koumaiha
TeknoSoft Inc
Farmington Hills, Michigan
 
erik,
In VFP 7.0/8.0:
Code:
ucNetName = GetWordNum(Sys(0),3)
ucMachine = GetWordNum(Sys(0),1)
In earlier versions:
If you load up FoxTools you could use:
Code:
ucNetName = WordNum(Sys(0),3)
ucMachine = WordNum(Sys(0),1)
Otherwise this works in all versions of VFP:
Code:
ucNetName=alltrim(substr(sys(0),at("#",sys(0))+1))
ucMachine=alltrim(substr(sys(0),1,at("#",sys(0))-1))
Rick
 
actually i found that

? getenv("username")

works for me. but thanks for your help anyways guys.

Erik
 
i also found that this command only works on winNT or 2k, but not on win98.
 
Actually, it will work on any system, but there has to be an environment variable set.
As in SET username=whoever. That line is usually in AUTOEXEC.* or CONFIG.*.
So in other words, I wouldn't rely on it being there.


-Dave S.-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top