PowerShell Check If File Exists - 10 Examples - Itechguides.com
Check if the file, E:\reports\first-file.txt exists. If it exists, delete the file. However, if the file does not exist, run the command in the Else block of the If statement. In this instance, the command in the Else loop is the word, Break. “ Break ” tells PowerShell to stop processing the script.