Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cmd 使用Windows命令提示符读取文本文件的最后10行_Cmd_Command Prompt - Fatal编程技术网

Cmd 使用Windows命令提示符读取文本文件的最后10行

Cmd 使用Windows命令提示符读取文本文件的最后10行,cmd,command-prompt,Cmd,Command Prompt,有谁能建议如何使用Windows命令提示符读取文本文件的最后10行吗?一种方法是使用PowerShell powershell -NoProfile -Command "Get-Content .\rrreg.ps1 | Select-Object -Last 3" 也可以对每一行进行迭代 FOR /F "usebackq tokens=*" %%s IN (`powershell -NoProfile -Command "Get-Content .\rrreg.ps1 | Select-Ob

有谁能建议如何使用Windows命令提示符读取文本文件的最后10行吗?

一种方法是使用PowerShell

powershell -NoProfile -Command "Get-Content .\rrreg.ps1 | Select-Object -Last 3"
也可以对每一行进行迭代

FOR /F "usebackq tokens=*" %%s IN (`powershell -NoProfile -Command "Get-Content .\rrreg.ps1 | Select-Object -Last 3"`) DO (
    ECHO %%s
)
当然,在系统上使用tail命令将使tail-10thefile.txt成为可能。比那容易多少?

可能的重复可能的重复