Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to set a system environment variable to use use the current logged in username. I'm tried the below using the username environment variable but it doesn't work. I'm using "setx /m" on windows 7 64bit to set the variable but they aren't being set to the current logged in user.

  • User_Network_Workspace = \network.share\Staff\%USERNAME%\workspace
  • User_Network_Pocation = \network.share\Staff\%USERNAME%\pkg

Is what I'm doing possible or is there an alternative. Essentially what I want is the ability to have an environment variable for every user that logs in to point to there staff folder.

Thanks in advance.

share|improve this question

migrated from Jan 12 '13 at 15:15

This question came from our site for professional and enthusiast programmers.

System environment variables are not expanded recursively. You'll need to use group policy, or a logon script or similar. – Harry Johnston Jan 9 '13 at 3:18
Cheers, looks like I'll need to modify my log on script. If I had Windows Server 2008 then it would be a lot easier – MarcusMaximus Jan 11 '13 at 5:49

You must log in to answer this question.

Browse other questions tagged .