Get the Path


Before I get too far into this part, I totally understand that this should be cleaned up a little bit.  Admittedly, this part was a quick hack together, but given the non-production nature of the script it didn't seem worth going back and fixing.

The Write-Host portion was really just left in from some initial testing, but I thought I'd leave it in the example to help with readability.  

Our original selection from the hash table just displayed / gathered the file name.  We could have adjusted the loop with the hash to attempt to gather the path information as well, but we opted to simply search for the file name that was selected.

We used get-childitem to find the item that was selected and then get the .pspath from the object.  Finally, we clean up the path statement a little bit using some powershell string functions.

Ultimately, the full path was just thrown into the variable $d.




No comments:

Post a Comment