Jon Koeter
Jon Koeter

Reputation: 1094

Junction point of mklink to environment variable path

I was wondering if it were posible to use use junction (or mklink?) to have c:\Projects point to the current users my documents\projects map.

I tried junction.exe c:\project "%HOMEPATH%\my documents\projects" but it just makes a link to the interpretation of the path and not to the variable (so c:\projects would point to administrator\my documents\projects instead of %HOMEPATH%).

I'm using Windows Server 2003 R2.

Thank you!

Upvotes: 1

Views: 3742

Answers (1)

joshuapoehls
joshuapoehls

Reputation: 35217

It isn't possible to do exactly what you are describing. i.e. Have a Junction that dynamically routes itself based on an environment variable.

You can get close to this behavior by creating a logon script that deletes and recreates the junction when the user logs in. Obviously this only works if there is only ever one user logged into the box at a time, otherwise they would be stomping over each other.

Upvotes: 1

Related Questions