Repository navigation
Open
Labels
Area-FileSystem-Providerspecific to the FileSystem providerIssue-BugIssue has been identified as a bug in the productUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issuesWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.WG-ReviewedA Working Group has reviewed this and made a recommendation
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Not sure whether this qualify a a bug, but if I use Set-Content -Confirm I need to confirm twice:
- on the operation "Set Content", and on
- on the operation "Clear Content" which is in fact an implicit operation
Although, there are several workarounds available, this behavior is quite disturbing when replacing the content of multiple files.
Set-Content -Value 'Foo' -Path .\Temp.txt
Set-Content -Value 'Bar' -Path .\Temp.txt -ConfirmExpected behavior
Confirm Are you sure you want to perform this action? Performing the operation "Set Content" on target "Path: .\Temp.txt". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Actual behavior
Confirm Are you sure you want to perform this action? Performing the operation "Set Content" on target "Path: .\Temp.txt". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y Confirm Are you sure you want to perform this action? Performing the operation "Clear Content" on target "Item: .\Temp.txt". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Error details
Note the secondEnvironment data
Name Value
---- -----
PSVersion 7.4.5
PSEdition Core
GitCommitId 7.4.5
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Reacted by Michael Klement
Metadata
Metadata
Assignees
Labels
Area-FileSystem-Providerspecific to the FileSystem providerIssue-BugIssue has been identified as a bug in the productUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issuesWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.WG-ReviewedA Working Group has reviewed this and made a recommendation
Activity
mklement0 commentedon Oct 15, 2024
Definitely a bug - it seems that (the implementing class behind)
Clear-Contentis called behind the scenes, which triggers the extra prompt.Not only should the
Clear-Contentprompt not show, if you respond withN, the file is still modified, but the-Valueis appended to the existing file (that is, you then getAdd-Contentbehavior).iRon7 commentedon Feb 12, 2025
Yes, this appears also from invoking
Set-Contenton a directory:rkeithhill commentedon Sep 8, 2025
WG-Engine reviewed this and agree this is a bug that should be investigated and fixed.
Set-Content: avoid double confirmation by using CmdletProviderContext…
Fix double -Confirm prompt in Set-Content (fixes PowerShell#24434)
iRon7 commentedon Mar 8, 2026
It is still unclear to me why issues marked as Up-for-Grabs are triggered to be closed...
doctordns commentedon Mar 8, 2026
My view is that this should NOT be the case. That said, something open for grabs that is not grabbed is not a great state to be in either.
Trigging after a week is wrong, I think we';d agree./ But after 6 months?: After a Year? If no one has taken up the opportunity, after a time, I'm not sure how much sense it makes to leave it open.
microsoft-github-policy-service commentedon Sep 5, 2026
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.
mklement0 commentedon Sep 5, 2026
Echoing iRon7's sentiment in different words: The sensible approach is to leave
Up-for-Grabsissues open indefinitely, so that community members - at whatever point in the future - can discover them, know that they've been green-lit for implementation, and therefore potentially submit PRs that may eventually provide a fix.The usefulness of an approved fix / improvement has no expiration date.