- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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
- How to resolve - Relative path is not supported in PowerShell DSC?
- What is the difference between PATH and CLASSPATH in Java?
- How to test the shared location path from the remote computer in PowerShell?
- How to use Split-Path command in PowerShell?
- Difference Between Test Plan and Test Strategy
- Eulerian Path and Circuit
- Path Testing & Basis Path Testing with Example
- How to Move an Element in a Circular Path with CSS offset-path (Motion Path)?
- How to validate the path with the PowerShell function parameter?
- Min Cost Path
- Path Loss Definition, Overview and Formula
- Difference between Use Case and Test Case
- Path methods in C#
- Path Sum in Python
- Simplify Path in Python