PowerShell Genie

When should you use -LiteralPath instead of -Path?

Question 1 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Use LiteralPath when the path must be interpreted exactly, especially when names contain wildcard characters such as brackets.

Interview · Question 5 of 34

Answer before reveal

Your draft

Write the answer you would give in an interview. The model answer stays hidden until you have drafted at least a short response.

Primary documentation

Get-Item reference

Continue
Genie guideWhen should you use -LiteralPath instead of -Path?

Use LiteralPath when the path must be interpreted exactly, especially when names contain wildcard characters such as brackets.