Powershell - Difference between -Path and -LiteralPath, -Name and -LiteralName parameters
To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make a donation. Thank you!
Hello,
The difference between the -Path and -LiteralPath, -Name and -LiteralName parameters lies in whether or not wildcards (*?[]) are supported.
Let’s check this with a few commands
# Test the following commands:get-item -LiteralPath C:\Windows\Systemget-item -Path C:\Windows\System# There is no difference
# Test the following commands:get-item -LiteralPath C:\Windows\System??get-item -Path C:\Windows\System??-LiteralPath does not work with wildcards
# You can check this by looking at the helpGet-Help Get-Item"-LiteralPath <System.String[]>""...""Accept wildcards? false"
"-Path <System.String[]>""...""Accept wildcards? True"
# Let's do a test by creating 2 foldersmkdir c:\bookmkdir c:\look
# Use wildcards to find the 2 foldersGet-Item -Path c:\[bl]ook# Both folders are displayedGet-Item -LiteralPath c:\[bl]ook# Aucun résultat
# Another test (characters [] are allowed in folder and file names)mkdir c:\[bl]ookGet-Item -LiteralPath c:\[bl]ook# The folder is displayed
The principle is the same with the -Name and -LiteralName parameters.
Related links
Powershell - Testing network connectivity and port accessibility
Testing network connectivity and port accessibility with PowershellPowershell - Display network connections (equivalent to netstat)
Display network connections (listening ports, active connections...)Powershell - Testing name resolution (equivalent to nslookup)
Powershell commands to test name resolution (equivalent to nslookup)Powershell - View and manage DNS configuration of network interfaces
Powershell commands to display and manage DNS configuration of network interfacesPowershell - Managing IP configuration of network interfaces
Powershell commands to view and modify the IP configuration of network interfacesPowershell - Managing the status and configuration of network interfaces
Powershell commands to view and modify the status and configuration of network interfaces (disable IPv6, enable/disable an interface)
Follow me on
Support me
Last content
Powershell - Testing network connectivity and port accessibility
Powershell - Display network connections (equivalent to netstat)
Powershell - Testing name resolution (equivalent to nslookup)
Powershell - View and manage DNS configuration of network interfaces
Powershell - Managing IP configuration of network interfaces
Powershell - Managing the status and configuration of network interfaces
Powershell and the Left Hand Side
Powershell - Managing disks, partitions and volumes