# Get username on windows

**URL:** <https://www.ruby-forum.com/t/get-username-on-windows/84897>\
**Category:** Ruby\
**Created:** [February 8, 2007, 2:33pm UTC](https://www.ruby-forum.com/t/get-username-on-windows/84897 "2007-02-08T14:33:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RebhanS\_Gilbert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7feea3/32.png) [@RebhanS\_Gilbert](https://www.ruby-forum.com/u/RebhanS_Gilbert)\
**Post date:** [February 8, 2007, 2:33pm UTC](https://www.ruby-forum.com/t/get-username-on-windows/84897/1 "2007-02-08T14:33:17Z")

</div>

Hi,

how to access the username on windows,  
the same as Systemproperty user.name in java ?

Regards, Gilbert

---

<div class="post-metadata">

**Author:** ![RebhanS\_Gilbert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7feea3/32.png) [@RebhanS\_Gilbert](https://www.ruby-forum.com/u/RebhanS_Gilbert)\
**Post date:** [February 8, 2007, 2:39pm UTC](https://www.ruby-forum.com/t/get-username-on-windows/84897/2 "2007-02-08T14:39:42Z")

</div>

Rebhan, Gilbert wrote:

> Hi,
> 
> how to access the username on windows,  
> the same as Systemproperty user.name in java ?
> 
> Regards, Gilbert

ENV[‘USERNAME’] works for me.
