Just to offer the alternative to the Test-Path
cmdlet (since nobody mentioned it):
[System.IO.File]::Exists($path)
Does (almost) the same thing as
Test-Path $path -PathType Leaf
except no support for wildcard characters
More Related Contents:
- Get-Aduser -Filter will not accept a variable
- Delete files older than 15 days using PowerShell
- How to load assemblies in PowerShell?
- try, catch doesent seem to work
- How to get Powershell Invoke-Restmethod to return body of http 500 code response
- Powershell ConvertTo-json with embedded hashtable
- How Does Member Enumeration Work in PowerShell 3?
- Powershell script to see currently logged in users (domain and machine) + status (active, idle, away)
- Powershell Using Start-Process in PSSession to Open Notepad
- ConvertTo-JSON an array with a single item
- Powershell – Reboot and Continue Script
- Get-Content -wait not working as described in the documentation
- PowerShell is missing the terminator: “
- Using PowerShell to remove lines from a text file if it contains a string
- Difference between PowerShell Console and PowerShell ISE
- Powershell: Set a Scheduled Task to run when user isn’t logged in
- List of all colors available for PowerShell?
- PowerShell says “execution of scripts is disabled on this system.”
- What’s the best way to determine the location of the current PowerShell script?
- PowerShell outputting array items when interpolating within double quotes
- How can I make PowerShell handle [ or ] in file name well?
- Get remote registry value
- Catching FULL exception message
- Replacing only the first occurrence of a word in a string
- How can I get the current PowerShell executing file?
- What’s the equivalent of xargs in PowerShell?
- Visual studio code cmd error: Cannot be loaded because running scripts is disabled on this system
- Invoke-WebRequest, POST with parameters
- PowerShell launch script in new instance
- How to return specific data type from PowerShell function i.e. DataTable