Convert string to directory object in PowerShell -
i read strings line line file (using get-content , foreach loop), want convert strings directory objects (so can access properties .fullname
). how convert string directory?
with files easy: $myfileasfile = $myfileasstr | dir $_
, however, how obtain goal $directoryasstring
?
okay, answer seems get-item
:
$dirasstr = '.\documents' $dirasdir = get-item $dirasstr echo $dirasdir.fullname
works!
Comments
Post a Comment