I have a file in c:\temp directory named as [default].xml.
When I issue command: get-childitem "c:\temp`[default].xml" in the powershell console, it returns me nothing. However if I issue this command: get-childitem "c:\temp*default].xml", it works as expected.
Why escape character on '[' is not working?
See get-help about_wildcards
The [] are wildcard "globbing" operators. To use get-childitem on files that have those characters, use the -literalpath switch to disable wildcarding of the file spec:
get-childitem -literalpath "c:\temp[default].xml"
Alternatively, normal wildcarding still works in the .getfiles() method of a directoryinfo object:
(get-item c:\).getfiles("temp[default].*")
You've got Microsoft official answer in an old Technet Windows PowerShell Tip of the Week.
You can use :
Get-ChildItem 'c:\temp\``[default``].xml'