powershell if file exists
# Check if file doesn't exists if (-not(Test-Path -Path "$directory/$file" -PathType Leaf)) { # File doesn't exist } # Check if file does exists if (Test-Path -Path "$directory/$file" -PathType Leaf) { # File does exist }
Source: adamtheautomator.com
powershell check if file exists
Test-Path <path to file> -PathType Leaf
Source: stackoverflow.com