PowerShell for Windows Admins

May 23 2019   1:20PM GMT

Create a symbolic link

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Tags:
Powershell

I recently had to create a symbolic link to overcome a bug in OpenSSH whereby OPENSSH won’t work with the path C:\Program Files\PowerShell\6\pwsh.exe because it has a space.

The answer is to create a symbolic link which is a file that contains a reference to another file (or directory):

New-Item -ItemType SymbolicLink -Path C:\pwsh -Target ‘C:\Program Files\PowerShell\6’

C:\pwsh is the symbolic link and the Target parameter has the original path. You can now use C:\pwsh in place of C:\Program Files\PowerShell\6

New-Item can also create a Hardlink or a Junction.

HardLink is a directory entry that associates a name with a file on disk

Junction is an NTFS artefact that is a pointer to a directory on the local volume

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: