I am preparing a script with Powershell.
I'd like to get the newest file name in a directory and assign the name to a string variable.
I've just written this one. I have a question:
dir C:\PREPARACION\logs | sort -prop LastWriteTime | select -last 1
Mode LastWriteTime Length Name
-a--- 9/6/2011 11:38 PM 442200 aswSnx.sys
However, what I want is to assign "aswSnx.sys" file name to a string.
Thanks in advance