axcx
asked on
getting current user's name
I need to run a file from the command line. The file is located in desktop folder:
C:\Users\username\Desktop\ file.txt
How can I automatically get current user's name and place it in the line above (instead of 'username')?
C:\Users\username\Desktop\
How can I automatically get current user's name and place it in the line above (instead of 'username')?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually, while %username% DOES grant the user name, if you are trying to access the user's profile, you should be using the %userprofile% environment variable, not %username% - in case the profile location has changed or runs on Windows XP (which you should be getting rid of).
Lee, ebad-it said that already which is why I didn't elaborate.
Steve
Steve
For instance a desktop entry for all users on a Windows 7 PC would be in %public%\desktop
Steve