Update request - How can I determine if a folder exists?
doctordns opened this issue · 4 comments
doctordns commented
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
termdew commented
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."
}
doctordns commented
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?
termdew commented
can be closed, as the blog post is released.