且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取文件名批量循环

更新时间:2022-01-21 08:10:02

在命令扩展被启用(Windows XP和更新,大致),您可以使用语法%〜NF(其中F为变量,〜n是它的名字请求)只得到文件名。

When Command Extensions are enabled (Windows XP and newer, roughly), you can use the syntax %~nF (where F is the variable and ~n is the request for its name) to only get the filename.

FOR /R C:\Directory %F in (*.*) do echo %~nF

应该只呼应的文件名。

should echo only the filenames.