Closed doctordns closed 3 years ago
Can this snippet be used as a solution? 🤔
"Test script if folder exists"
$path = Read-Host -Prompt 'Please enter a path '
if (Test-Path $path) {
"Path exists!"
} else {
"Path doesn't exist."
}
That would indeed be a solution. Works in Windows PowerShell too. I'd rewrite this slightly for the blog:
$Folder = 'C:\Windows'
"Test to see if folder [$Folder] exists"
if (Test-Path -Path $Folder) {
"Path exists!"
} else {
"Path doesn't exist."
}
All you have to do now is to write the article?
can be closed, as the blog post is released.
resolved by #36 - closing this issue.
Request that this post from the older Scripting guys blog be updated and added.
Summary of the update request
Link to the post in the old blog: https://devblogs.microsoft.com/scripting/how-can-i-determine-if-a-folder-exists-on-a-computer/
Description of what needs to be changed: update to work with PowerShell