Repository navigation
Description
Steps to reproduce
Follow example 7 here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-item?view=powershell-7powershell!
- Create a folder eg. named "power"
- In this (power) folder create an empty folder named "Notice"
- In this (power) folder create a file named "Notice.txt"
- As admin run this script:
New-Item -ItemType Junction -Path .\link.txt -Target .\Notice.txt
New-Item -ItemType Junction -Path .\link -Target .\Notice -Force
Expected behavior
Create two functioning links for both a file and a folder
Actual behavior
PS C:\retus\test2Die\power problems> .\test.ps1
New-Item: C:\retus\test2Die\power problems\test.ps1:1
Line |
1 | New-Item -ItemType Junction -Path .\link.txt -Target .\Notice.txt
|
| Could not find item .\Notice.txt.
New-Item: C:\retus\test2Die\power problems\test.ps1:3
Line |
3 | New-Item -ItemType Junction -Path .\link -Target .\Notice -Force
|
| Could not find item .\Notice.
#NOTE
Works with absolute path
Environment data
PS C:\retus\test2Die\power problems> $psversiontable
Name Value
PSVersion 7.1.0-preview.3
PSEdition Core
GitCommitId 7.1.0-preview.3
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Activity
KalleOlaviNiemitalo commentedon May 25, 2020
AFAIK, Windows supports directory junctions but not file junctions. PowerShell 7.1.0-preview.3 outputs a saner error message than PowerShell 7.0.0, but both lose to Windows PowerShell 5.1.
PowerShell 7.1.0-preview.3
PowerShell 7.0.0
Windows PowerShell 5.1
Windows PowerShell 2.0
Does not support
New-Item -ItemType Junction.KalleOlaviNiemitalo commentedon May 25, 2020
Process Monitor and WinDbg show that PowerShell 7.1.0-preview.3 is calling
GetFileAttributesExWonNotice.txtin the current directory of the process as shown by[Environment]::CurrentDirectory, not in the directory that I selected withSet-Location.Perhaps
FileSystemProvider.NewItemis callingGetFileSystemInfowith a relative path and it needs an absolute path. If I bypass the #8783 change by using a wildcard in-Target, then PowerShell 7.1.0-preview.3 gives the correct error message:iSazonov commentedon May 26, 2020
DupRelated #12784sukkergris commentedon Jun 3, 2020
Ilya (@iSazonov) - Not sure why this is considered a dup of #12784. One i targeted junctions and the other targeted symlinks and each bug has different symptoms :)
iSazonov commentedon Jun 3, 2020
My thoughts was that it will be fixed in the same place but I am ok to re-open.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.