Getting the currently logged in user under Windows

Michael Kann mikekann at yahoo.com
Mon May 17 10:37:34 EDT 2010


Malte, should work the same under XP. The shell command "set user" gives the reply:

userdnsdomain=fake.edu
userdomain=fake_domain
username=fake_name
userprofile=C:\Documents and Settings\mike
-----------------------------------------------

Can anyone test if this works under XP and / or WIn 7, even when not logged in with admin rights?

-- I'm afraid to log in any way except the way I always do it -- I might screw something up.

Mike



--- On Mon, 5/17/10, Malte Pfaff-Brill <revolution at derbrill.de> wrote:

> From: Malte Pfaff-Brill <revolution at derbrill.de>
> Subject: Getting the currently logged in user under Windows
> To: use-revolution at lists.runrev.com
> Date: Monday, May 17, 2010, 9:05 AM
> Hi all,
> 
> I am using this under Vista to identify the currently
> logged in user:
> 
> function getUserName
>   local tUser
>   set the hideconsolewindows to true
>   put shell("set user") into tUser
>   set the itemDel to "="
>   repeat for each line theLine in tUser
>      if item 1 of theLine="USERNAME"
> then
>         return item 2 to -1 of theLine
>      end if
>   end repeat
>   return tUser
> end getUserName
> 
> Is there a simpler way? Can anyone test if this works under
> XP and / or WIn 7, even when not logged in with admin
> rights?
> 
> All the best,
> 
> malte
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 


      



More information about the use-livecode mailing list