Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8672311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:10:20+00:00 2026-06-12T19:10:20+00:00

Possible Duplicate: How to read Windows loged in username with PHP/IIS I’m work on

  • 0

Possible Duplicate:
How to read Windows loged in username with PHP/IIS

I’m work on php tool that generate Data Access layer and generate some folders and files to user but i need to know how can i get username for current windows user to generate these folders on desktop

ex:
C:\\users\\<username>\\desktop

I need to know the username.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:10:21+00:00Added an answer on June 12, 2026 at 7:10 pm

    If by current windows user you mean the user running the script then that is set in an environment variable which you can get using:

    <?php echo getenv("username"); ?>
    

    If you want to get the home directory of the user running the script you should use

    <?php echo getenv("HOMEDRIVE") . getenv("HOMEPATH"); ?>
    

    This should output either C:\Users\Fred or C:\Documents and Settings\Fred depending on if you are using windows Vista/7 or windows XP.

    To see all of the environment variables you can do:

    <?php global $_ENV; var_dump($_ENV); ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Read Post Data submitted to ASP.Net Form I have a google checkout
Possible Duplicate: Is stl vector concurrent read thread-safe? I have a multi-threaded program that
Possible Duplicate: Search-like highlighting in NSTextView I thought i read here months ago that
Possible Duplicate: How do I read a “,” as “<br />” in PHP/MySQL? This
Possible Duplicate: read/write to Windows Registry using Java I want to read the registry
Possible Duplicate: Read large amount of data from file in Java I have a
Possible Duplicate: Read csv with two headers into a data.frame I am new to
Possible Duplicate: read XML tag id from php what is the way to fetch
Possible Duplicate: Why is require_once so bad to use? I've read somewhere that the
Possible Duplicate: Read file which is in use? I am trying to access a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.