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

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -