PowerShell v2 Function Show HiddenFolder

As a corollary to my Hide-Folder function this simply switches a folder items Attibutes to Directory.
function Show-HiddenFolder
{
      param(
            $foldername
      )
     
      if((Test-Path $foldername) -and ((Get-Item $folderName).PSIsContainer))
      {
            $(Get-Item $foldername -Force).Attributes = Directory
      }
      else
      {
            Write-Error "The folder ($($foldername)) was not found."
      }
}
I am sure there are a hundred better ways to do this, but, this is what I came up with for a quick fix.

Related Posts by Categories

0 comments:

Post a Comment