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

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.
Who is Participating?
greg wardSystems EngineerCommented:
Its pretty close and much better than  c:\users\%username%\ as when you have more than one domain with the logon the same the username for the second domain becomes username.domain :(
the below link takes this even further.

C$?   For instance, C$\Users\jdoe75\Desktop\filename.exe
hendricksonHelpAuthor Commented:
how does this change if a different user is logged in?
hendricksonHelpAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.