如何在 Windows 中使用“dir”命令根据上次更新时间对文件进行排序

Man*_*jan 3 windows powershell command-line

我在 Windows 10 的命令行提示符下使用“dir”命令。我尝试了以下操作:

c:\my_folder> dir /s /b
Run Code Online (Sandbox Code Playgroud)

但是,上面的命令并没有根据文件的最后更新时间来显示文件。

kro*_*lko 7

打开powershell 控制台并输入以下命令:

Get-ChildItem | Sort-Object -Property LastWriteTime
Run Code Online (Sandbox Code Playgroud)

如果您想要降序排列,请使用:

Get-ChildItem | Sort-Object -Property LastWriteTime -Descending
Run Code Online (Sandbox Code Playgroud)

  • 我的天啊。我必须输入所有_that_?与“ls -lrt”相反?这是什么地狱操作系统? (2认同)