PowerShell-Docs icon indicating copy to clipboard operation
PowerShell-Docs copied to clipboard

Document `-Force` parameter for `Resolve-Path` and `Convert-Path` cmdlets

Open ArmaanMcleod opened this issue 1 year ago • 0 comments

Prerequisites

  • [X] Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
  • [X] Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Document new Get-Foo cmdlet" instead of "New cmdlet."

Summary

Added -Force parameter to Resolve-Path and Convert-Path cmdlets to support wildcard hidden files. This new parameter should be documented in help page.

Details

Example 1

HIdden files(in this case .git folder) are not shown without -Force. This is current behaviour.

> Resolve-Path -Path .git*

Path
----
C:\Users\armaa\Documents\git-repos\PowerShell\.github
C:\Users\armaa\Documents\git-repos\PowerShell\.gitattributes
C:\Users\armaa\Documents\git-repos\PowerShell\.gitignore

> Convert-Path -Path .git*
C:\Users\armaa\Documents\git-repos\PowerShell\.github
C:\Users\armaa\Documents\git-repos\PowerShell\.gitattributes
C:\Users\armaa\Documents\git-repos\PowerShell\.gitignore

Example 2

All HIdden files(in this case including .git folder) are shown with -Force. This is new behaviour.

> Resolve-Path -Path .git* -Force

Path
----
C:\Users\armaa\Documents\git-repos\PowerShell\.git
C:\Users\armaa\Documents\git-repos\PowerShell\.github
C:\Users\armaa\Documents\git-repos\PowerShell\.gitattributes
C:\Users\armaa\Documents\git-repos\PowerShell\.gitignore

> Convert-Path -Path .git* -Force
C:\Users\armaa\Documents\git-repos\PowerShell\.git
C:\Users\armaa\Documents\git-repos\PowerShell\.github
C:\Users\armaa\Documents\git-repos\PowerShell\.gitattributes
C:\Users\armaa\Documents\git-repos\PowerShell\.gitignore

Articles

  • reference/7.4/Microsoft.PowerShell.Management/Resolve-Path.md
  • reference/7.4/Microsoft.PowerShell.Management/Convert-Path.md

Related Source Pull Requests

  • PowerShell/PowerShell#20981

Related Source Issues

  • PowerShell/PowerShell#20929

ArmaanMcleod avatar Jan 01 '24 22:01 ArmaanMcleod