- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between Test-Path and Resolve-Path in PowerShell?
Test-Path command checks if the particular path exists or not and returns the Boolean output (True or False) while Resolve-Path command displays the particular directory if exists otherwise throws an exception. For example,
For the path to exist,
PS C:\> Test-Path C:\Temp\ True PS C:\> Resolve-Path C:\Temp\ Path ---- C:\Temp\
For the path doesn’t exist,
PS C:\> Test-Path C:\Temp11\ False PS C:\> Resolve-Path C:\Temp11\ Resolve-Path : Cannot find path 'C:\Temp11\' because it does not exist. At line:1 char:1 + Resolve-Path C:\Temp11\ + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\Temp11\:String) [Resolve-Path], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.ResolvePathCommand
Resolve-Path is also used to get the file content using the wildcard character. For example,
The above command will get all the files and folders inside the C:\temp path.
The above command will get all the files from the C:\temp with the Web starting keyword.
Path ---- C:\Temp\WebImages C:\Temp\web.html C:\Temp\web1.html
- Related Articles
- How to resolve - Relative path is not supported in PowerShell DSC?
- How to test the shared location path from the remote computer in PowerShell?
- What is the difference between PATH and CLASSPATH in Java?
- How to use Split-Path command in PowerShell?
- How to validate the path with the PowerShell function parameter?
- How to get the path of the currently executing script in PowerShell?
- How to Move an Element in a Circular Path with CSS offset-path (Motion Path)?
- Path Testing & Basis Path Testing with Example
- Eulerian Path and Circuit
- Difference Between Test Plan and Test Strategy
- Difference between Antibody Test and PCR Test
- Difference between Antibody Test and Swab Test
- Difference Between Dielectric Test and Insulation Test
- Difference between PowerShell and CMD
- How to copy Items to the destination path with the different\ncredentials in PowerShell?