When i attempt to create a new symbolink link with the target (Value) path set to a string of "%UserProfile%\dir1\dir2\file.ext" the resultant path is prepended with the directory the script is run from.
$targetpath = '%UserProfile%\dir1\dir2\filename.ext'
New-Item -Path $currpath -ItemType SymbolicLink -Value ($targetpath) -Force
so if i run the script from c:\scripts\ the Value becomes c:\scripts%UserProfile%\dir1\dir2\filename.ext. Anyone know of a way around this? I am able to modify i an existing symbolic link to use this path and it functions as intended but can't seem to do this programmatically.
Note: MkLink and comobject.createshortcut exhibit the same behavior.