Powershell Symbolic Links in Windows 10
Recently, I’ve been using more the Powershell1 prompt rather than the old command prompt2. Both command consoles can still run on Windows 10, but on recent occasions I prefer the Powershell as you can use it to create more complex shell scripts on Windows and access some C# modules.
A chain is only as strong as its weakest link.
— Anonymous.
On my previous recent post about moving ProgramData
to another drive, I’ve use the mklink
utility to create junction directory to-and-from. So here are the equivalent commands:
Command Prompt Syntax | Powershell Equivalent Syntax |
---|---|
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 |
The New-Item
command is also analogous to Unix touch
command tool.
Check the definition of the commands before running on your system.
That’s all guys!
Leave a comment if you have questions or queries. Also, you can DM me on twitter 😉.
💻
- PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-source and cross-platform on 18 August 2016 with the introduction of PowerShell Core. ↩︎
- The name refers to its executable filename. It is also commonly referred to as cmd or the Command Prompt, referring to the default window title on Windows. The implementations differ on the various systems, but the behavior and basic set of commands is generally consistent. cmd.exe is the counterpart of COMMAND.COM in DOS and Windows 9x systems, and analogous to the Unix shells used on Unix-like systems. ↩︎