Sunday, August 7, 2016

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 Post:

0 comments:

Post a Comment

 
Copyright 2009 Information Blog
Powered By Blogger