1. Information
-
Note: Hard links are not detected on network mapped drives.
-
Enter the following commands at a PowerShell Command Prompt.
Get-ChildItem -Path <Folder> | Select-Object FullName, LinkType, Target Get-ChildItem -Path <Folder> | Select-Object FullName, LastWriteTime, LinkType, Target Get-ChildItem -Path <Folder> | Select-Object FullName, Length, LastWriteTime, LinkType, Target | Format-Table
2. Hard Links
2.1. Create
-
Note: Hard links can only be created for files.
-
Enter the following commands at a PowerShell Command Prompt.
Set-Location <Folder> New-Item -ItemType HardLink -Name <Link> -Value <File>
2.2. Delete
-
Note: Hard links can only be created for files.
-
Enter the following commands at a PowerShell Command Prompt.
Remove-Item -Path <Link> # Remove hard link to file.
3. Junctions
3.1. Create
-
Note: Junctions can only be created for directories.
-
Enter the following commands at a PowerShell Command Prompt.
Set-Location <Folder> New-Item -ItemType Junction -Name <Link> -Value <Folder>
3.2. Delete
-
Enter the following commands at a PowerShell Command Prompt.
Remove-Item -Force -Path <Link> # Remove junction to directory.
4. Symbolic Links
4.1. Create
-
Note: Symbolic links can be created for both directories and files.
-
Enter the following commands at a PowerShell Command Prompt with administrative privileges.
Set-Location <Folder> New-Item -ItemType SymbolicLink -Name <Link> -Value <File> New-Item -ItemType SymbolicLink -Name <Link> -Value <Folder>
4.2. Delete
-
Note: Symbolic links can be removed for both directories and files.
-
Enter the following commands at a PowerShell Command Prompt.
Remove-Item -Path <Link> # Remove symbolic link to file. (Get-ItemProperty -Path <Link>).Delete() # Remove symbolic link to folder.