We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


How do I make a dynamic windows path that is unique for every user that logs into a computer?

Medium Priority
Last Modified: 2012-05-11
I need to dynamically get the path name of a file located on the user's desktop.  This path name will be different for every user.  For example, if user jdoe75 is logged in, the path to the desktop would be "C:\Users\jdoe75\Desktop\filename.exe" then if user lbird15 logs in, the path would be "C:\Users\lbird15\Desktop".

I need a way to access the desktop file of whomever is logged in at that moment.  I know it has something to do with windows variables and percent signs, but I couldn't find a specific reference for my exact issue.
Watch Question

C$?   For instance, C$\Users\jdoe75\Desktop\filename.exe


how does this change if a different user is logged in?


Like I said, I know it has something to do with percent signs and windows environment variables.  I would probably look something like this:  c:\users\%username%\desktop\filename.exe
I just don't know what the variable is that I should be using.
Senior Systems Engineer
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.