PowerShell Resolve-Path Cmdlet
Hello Everyone
Welcome to CloudAffaire and this is Debjeet.
In the last blog post, we have discussed Join-Path cmdlet in PowerShell.
https://cloudaffaire.com/powershell-join-path-cmdlet/
In this blog post, we will discuss Resolve-Path cmdlet in PowerShell. You can use Resolve-Path cmdlet to check if a path exists to the specified location defined by the path parameter. Resolve-Path cmdlet can be used to resolve the path of a file, directory, or registry key.
Resolve-Path Cmdlet Syntax:
1 2 3 4 5 6 |
## Resolve-Path ## [-Path] ## [-Relative] ## [-Credential ## [-UseTransaction] ## [ |
Resolve-Path Cmdlet Argument List:
- –Credential: To impersonate another user or elevate your credentials
- –LiteralPath: Specifies the path to be resolved. The value of the LiteralPath parameter is used exactly as typed. No characters are interpreted as wildcard characters.
- –Path: Specifies the main path (or paths) to which the child-path is appended. Wildcards are permitted.
- –Relative: Indicates that this cmdlet returns a relative path.
- –UseTransaction: Includes the command in the active transaction. This parameter is valid only when a transaction is in progress.
PowerShell Resolve-Path Cmdlet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
######################################## ## PowerShell | Cmdlet | Resolve-Path ## ######################################## ## PowerShell Latest Version (5) ## resolve home directory of current user in PowerShell Resolve-Path ~ ## resolve path of a directory in PowerShell Resolve-Path -Path C:\Windows\System32\drivers\etc ## resolve path of a file in PowerShell Resolve-Path -Path C:\Windows\System32\drivers\etc\hosts ## resolve path of a registry key in PowerShell Resolve-Path -Path HKCU:\Software\Microsoft\Notepad ## resolve path having a wildcard character in PowerShell Resolve-Path -Path C:\Program* ## resolve path and get the relative path from current directory in PowerShell Resolve-Path -Path C:\Windows\System32\drivers\etc -Relative |
Hope you have enjoyed this article. In the next blog post, we will discuss Get-Service cmdlet in PowerShell.
To Set more details on PowerShell, kindly follow below official documentation