Here's the deal. I want to use a symbolic link to the latest installed Java version and create a symbolic link. The PATH variable shall contain the symbolic link as entry. The link is not resolved, though. Why?
$> dir C:\Program\ Files\Java C:\Program\ Files\Java\jdk-1.14.1\ C:\Program\ Files\Java\jdk-latest.lnk # link to jdk-1.14.1 $> echo %PATH% #... C:\Program\ Files\Java\jdk-latest\bin $> java --version The command "java" is either written wrong or couldn't be found.
mklink /j jdk-latest jdk-1.14.1or a directory symlink created via
mklink /d jdk-latest jdk-1.14.1(this is a relative link; you could also link to the absolute path). A bind mountpoint can be created without any special privilege. Creating a symlink requires SeCreateSymbolicLinkPrivilege. If this privilege is not assigned explicitly to the user or one of the user's non-administrator groups, then it's only available by elevating to full administrator access.
New-Item cmdlet with
-ItemType SymbolicLink can be used to create symbolic link to file or folder.
Suppose, you have 2 folders containing 2 different versions of nodejs
We need one symbolic link, say
rel which will point to one of the nodejs folders.
C:\Program\Files\nodejs\rel to PATH environment variable
Point rel to node v14.18.0
New-Item -Type SymbolicLink -Path .\rel -Target .\node-v14.18.0-win-x64 -Force
Verify node version
PS C:\Users\pvaddepa> node -v v14.18.0
-Force to update the symbolic link to point to node v14.20.0.
New-Item -Type SymbolicLink -Path .\rel -Target .\node-v14.20.0-win-x64 -Force
Verify the node version
PS C:\Users\pvaddepa> node -v v14.20.0
See New-Item example .