Set a location to a Variable in PowerShell -
i'm new powershell, , i'm sure simple question i'm little stumped. i'm trying open folder, sort lastwritetime, , open folder @ top of list. want store in variable when call variable can set location variable. problem i'm having when call variable, nothing happens:
$latest = get-childitem c:\main | sort lastwritetime -descending | select -first 1 | invoke-item
how come error when try 'set-location $latest'?
i use tee-object set variable $latest directory , continue sending directory object down pipeline.
get-childitem c:\main | sort lastwritetime -descending | select-object -first 1 | tee-object -variable latest | invoke-item
Comments
Post a Comment