- PowerShell Tutorial
- PowerShell - Home
- PowerShell - Overview
- PowerShell - Environment Setup
- PowerShell - Cmdlets
- PowerShell - Files and Folders
- PowerShell - Dates and Timers
- PowerShell - Files I/O
- PowerShell - Advanced Cmdlets
- PowerShell - Scripting
- PowerShell - Special Variables
- PowerShell - Operators
- PowerShell - Looping
- PowerShell - Conditions
- PowerShell - Array
- PowerShell - Hashtables
- PowerShell - Regex
- PowerShell - Backtick
- PowerShell - Brackets
- PowerShell - Alias
- PowerShell Useful Resources
- PowerShell - Quick Guide
- PowerShell - Useful Resources
- PowerShell - Discussion
Powershell - Check Folder Existence
Cmdlet
Test-Path cmdlet is used to check existence of a folder.
Example 1
In this example, we're having a folder test in D:\temp directory
Type the following command in PowerShell ISE Console
Test-Path D:\temp\test
Output
You can see following output in PowerShell console.
Test-Path D:\temp\test True
Example 2
In this example, we're not having a folder named test2 in D:\temp directory
Type the following command in PowerShell ISE Console
Test-Path D:\temp\test2
Output
You can see following output in PowerShell console.
Test-Path D:\temp\test2 False
powershell_files_folders.htm
Advertisements
To Continue Learning Please Login
Login with Google