标签:first roi Owner tor 高手 session MLOG ati creation
PS C:\Users\Administrator>dir
目录: C:\Users\Administrator
Mode LastWriteTime Length Name
d---- 2019-1-16 14:00 .android
d---- 2019-2-20 17:24 .BigNox
d---- 2017-12-13 11:53 .idlerc
d---- 2018-10-9 15:38 .LdVirtualBox
d---- 2018-11-13 9:00 .matplotlib
d---- 2018-10-15 9:22 .PyCharmCE2018.2
d---- 2017-11-30 9:34 .VirtualBox
d-r-- 2017-9-30 11:19 Contacts
d-r-- 2019-3-11 17:34 Desktop
d-r-- 2019-1-11 14:32 Documents
d-r-- 2019-3-5 9:20 Downloads
d-r-- 2019-2-20 17:56 Favorites
d-r-- 2017-9-30 11:19 Links
d---- 2018-5-30 11:26 ncftp
d---- 2018-10-10 9:12 Nox_share
d-r-- 2018-10-9 15:37 Pictures
d-r-- 2017-9-30 11:19 Saved Games
d-r-- 2017-9-30 11:19 Searches
d---- 2019-1-8 9:40 UIDowner
d-r-- 2018-10-9 15:37 Videos
d-r-- 2017-11-30 9:59 Virtual Machines
d---- 2017-11-30 9:34 VirtualBox VMs
d---- 2019-2-20 17:24 vmlogs
d---- 2018-9-26 15:13 新建文件夹
-a--- 2019-2-27 9:10 216962 a.html
-a--- 2019-3-8 15:02 0 a.txt
-a--- 2018-10-10 9:12 66 inittk.ini
-a--- 2018-10-10 9:12 41 inst.ini
-a--- 2018-10-10 9:12 45 nuuid.ini
-a--- 2018-12-18 10:37 616 SciTE.session
PS C:\Users\Administrator> dir |where {$_.Mode -like "*a*"}|Sort-Object LastWriteTime -Descending
目录: C:\Users\Administrator
Mode LastWriteTime Length Name
-a--- 2019-3-8 15:02 0 a.txt
-a--- 2019-2-27 9:10 216962 a.html
-a--- 2018-12-18 10:37 616 SciTE.session
-a--- 2018-10-10 9:12 66 inittk.ini
-a--- 2018-10-10 9:12 45 nuuid.ini
-a--- 2018-10-10 9:12 41 inst.ini
PS C:\Users\Administrator> dir |where {$_.Mode -like "*a*"}|Sort-Object LastWriteTime -Descending|select -first 1
目录: C:\Users\Administrator
Mode LastWriteTime Length Name
-a--- 2019-3-8 15:02 0 a.txt
PS C:\Users\Administrator> dir |where {$_.Mode -like "*a*"}|Sort-Object LastWriteTime -Descending|select -first 1|fl
目录: C:\Users\Administrator
Name : a.txt
Length : 0
CreationTime : 2019-3-8 15:02:27
LastWriteTime : 2019-3-8 15:02:27
LastAccessTime : 2019-3-8 15:02:27
VersionInfo : File: C:\Users\Administrator\a.txt
InternalName:
OriginalFilename:
FileVersion:
FileDescription:
Product:
ProductVersion:
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language:
PS C:\Users\Administrator>dir |where {$_.Mode -like "*a*"}|Sort-Object LastWriteTime -Descending|select -first 1|fl Name
Name : a.txt
PS C:\Users\Administrator> dir |where {$_.Mode -like "*a*"}|Sort-Object LastWriteTime -Descending|select -first 1|fl Name|out-string
Name : a.txt
--所以最后用到的完整语句是:--
PS C:\Users\Administrator> (dir |where {$_.Mode -like "*a*"}|Sort-Object LastWriteTime -Descending|select -first 1|fl Name|out-string).Split(":")[-1]
a.txt
PS:本人刚接触POWERSHELL,知道这应该不是最简洁、准确的写法,只是做个记录,忘高手指教,多谢!
Powershell: powershell获取当前目录下最新创建的文件
标签:first roi Owner tor 高手 session MLOG ati creation
原文地址:https://blog.51cto.com/jimmyduan/2361571