How do you create a new symlink in windows 10 using powershell (not mklink.exe)?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 3
--
Chapters
00:00 How Do You Create A New Symlink In Windows 10 Using Powershell (Not Mklink.Exe)?
00:25 Accepted Answer Score 65
01:08 Answer 2 Score 60
01:42 Thank you
--
Full question
https://superuser.com/questions/1307360/...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows10 #powershell
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 3
--
Chapters
00:00 How Do You Create A New Symlink In Windows 10 Using Powershell (Not Mklink.Exe)?
00:25 Accepted Answer Score 65
01:08 Answer 2 Score 60
01:42 Thank you
--
Full question
https://superuser.com/questions/1307360/...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows10 #powershell
#avk47
ACCEPTED ANSWER
Score 65
- Start powershell as admin
- You need to know 1) the
path to target
of the link 2)path to location
where you want the link 3)the name
you want to use to refer to the link. PS C:\> new-item -itemtype symboliclink -path <path to location> -name <the name> -value <path to target>
Example: If you're in c:\drivers\AMD and you want to link in f:\driver\olddrivers, then you would go
PS C:\> new-item -itemtype symboliclink -path . -name OldDrivers -value f:\driver\olddrivers
And wind up with a symlink path of c:\driver\AMD\OldDrivers
ANSWER 2
Score 60
Use the New-Item
cmdlet and specify the appropriate ItemType
of SymbolicLink
, HardLink
, or Junction
. Note that these are only available from PowerShell 5.1 or newer.
+-----------------------+-----------------------------------------------------------+
| mklink syntax | PowerShell equivalent |
+-----------------------+-----------------------------------------------------------+
| mklink Link Target | New-Item -ItemType SymbolicLink -Name Link -Target Target |
| mklink /D Link Target | New-Item -ItemType SymbolicLink -Name Link -Target Target |
| mklink /H Link Target | New-Item -ItemType HardLink -Name Link -Target Target |
| mklink /J Link Target | New-Item -ItemType Junction -Name Link -Target Target |
+-----------------------+-----------------------------------------------------------+