Repository navigation
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productOS-LinuxOS-macOSWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Description
Steps to reproduce
1. md /home/yanbing/test
2. New-PSDrive -name TESTDRIVE -ROOT /home/bingbing/test -PSProvider FileSystem
Name Used (GB) Free (GB) Provider Root CurrentLocati
on
---- --------- --------- -------- ---- -------------
TESTDRIVE 13.16 109.75 FileSystem /home/bingbing/test
'abc' | Set-Content -NoNewline -Path TESTDRIVE:/testfile.txt
Set-Content : Could not find a part of the path
'/home/yanbing/test/home/yanbing/test/home/yanbing/test/testfile.txt'.
At line:1 char:12
+ 'abc' | Set-Content -NoNewline -Path TESTDRIVE:testfile.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (/home/yanbing/t...st/testfile.txt:String) [Set-Content
], DirectoryNotFoundException
+ FullyQualifiedErrorId : GetContentWriterDirectoryNotFoundError,Microsoft.PowerShell.Commands.SetContentCommand
Expected behavior
Should create a file and set the content
Actual behavior
the path got appended three times so can not be found on the system.
If the file already exist, the content can be set to the right file.
Environment data
Name Value
---- -----
PSVersion 6.0.0-alpha
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.8
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productOS-LinuxOS-macOSWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Activity
[-]on Iimunx Set-content does not interpret the psdrive path correctly when the file does not exist[/-][+]Set-content does not interpret the psdrive path correctly when the file does not exist[/+]vors commentedon Sep 8, 2016
Confirmed on OS X.
Yanbing (@bingbing8) I updated the issue text to use proper formatting. Please, use markdown for issues. For details, see this comment #2144 (comment)
charub commentedon Oct 5, 2016
Issue repro's on PowerShell Core on Windows as well. More Info :
Name Value
PSRemotingProtocolVersion 2.3
CLRVersion
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
BuildVersion 3.0.0.0
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSEdition Core
PSVersion 6.0.0-alpha
GitCommitId v6.0.0-alpha.10
Fix set-content failure for creating file in psdrive. (#2392)
daxian-dbw commentedon Nov 1, 2016
Resolved by PR #2392
Fix set-content failure for creating file in psdrive. (PowerShell#2392)