#Full path of the folder
$folder1 = ‘c:\users\backupnt04\downloads’
If the folder exists, show message it exist.
if (Test-Path -Path $folder1 -PathType Container) {
try {Write-Host “Checked: The folder [$folder1] exist.”
} catch {throw $_.Exception.Message}
}
If the file does not exist, show a message it doesn’t exist.
else {Write-Host “Checked: The folder [$folder1] does not exist.”
}
$folder2 = ‘c:\users\backupnt04\desktop’
if (Test-Path -Path $folder2 -PathType Container) {
try {Write-Host “Checked: The folder [$folder2] exist.”
} catch {throw $_.Exception.Message}
}
else {Write-Host “Checked: The folder [$folder2] does not exist.”
}
$folder3 = ‘c:\users\shicorp\downloads’
if (Test-Path -Path $folder3 -PathType Container) {
try {Write-Host “Checked: The folder [$folder3] exist.”
} catch {throw $_.Exception.Message}
}
else {Write-Host “Checked: The folder [$folder3] does not exist.”
}
$folder4 = ‘c:\users\shicorp\desktop’
if (Test-Path -Path $folder4 -PathType Container) {
try {Write-Host “Checked: The folder [$folder3] exist.”
} catch {throw $_.Exception.Message}
}
else {Write-Host “Checked: The folder [$folder4] does not exist.”
}
$folder5 = ‘c:\users\cfahey\downloads’
if (Test-Path -Path $folder5 -PathType Container) {
try {Write-Host “Checked: The folder [$folder3] exist.”
} catch {throw $_.Exception.Message}
}
else {Write-Host “Checked: The folder [$folder5] does not exist.”
}
$folder6 = ‘c:\users\cfahey\desktop’
if (Test-Path -Path $folder6 -PathType Container) {
try {Write-Host “Checked: The folder [$folder3] exist.”
} catch {throw $_.Exception.Message}
}
else {Write-Host “Checked: The folder [$folder6] does not exist.”
}
$folder7 = ‘c:\users\jburke\downloads’
if (Test-Path -Path $folder7 -PathType Container) {
try {Write-Host “Checked: The folder [$folder3] exist.”
} catch {throw $_.Exception.Message}
}
else {Write-Host “Checked: The folder [$folder7] does not exist.”
}