Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Test-Path

Test-Path - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Test-Path

Description
Return true if the path exists, otherwise return false

Usage


Options


Example(s)
Determine whether all elements (folders) in the path exist:

PS C:\>test-path "F:\MSSQL\BACKUP"

Determine whether there are any files in the Spreadsheets folder other than .xlsx files:

PS C:\>test-path C:\Spreadsheets\* -exclude *.xlsx

Determine whether the path stored in the $profile variable leads to a directory or a file:

PS C:\>test-path $profile -pathtype leaf