Windows Batch: Remove file extension

Posted johnsonshu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Windows Batch: Remove file extension相关的知识,希望对你有一定的参考价值。

You can use %%~nf to get the filename only as described in the reference for for:

@echo off
    for /R "C:\\Users\\Admin\\Ordner" %%f in (*.flv) do (
    echo %%~nf
)
pause

The following options are available:

Variable with modifier  Description
%~I                     Expands %I which removes any surrounding 
                        quotation marks ("").
%~fI                    Expands %I to a fully qualified path name.
%~dI                    Expands %I to a drive letter only.
%~pI                    Expands %I to a path only.
%~nI                    Expands %I to a file name only.
%~xI                    Expands %I to a file extension only.
%~sI                    Expands path to contain short names only.
%~aI                    Expands %I to the file attributes of file.
%~tI                    Expands %I to the date and time of file.
%~zI                    Expands %I to the size of file.
%~$PATH:I               Searches the directories listed in the PATH environment 
                        variable and expands %I to the fully qualified name of 
                        the first one found. If the environment variable name is 
                        not defined or the file is not found by the search,
                        this modifier expands to the empty string.    

  

以上是关于Windows Batch: Remove file extension的主要内容,如果未能解决你的问题,请参考以下文章

使用 BATCH 关闭所有 Firefox 选项卡

remove id #id#

Windows下MySQL自动备份的batch脚本

tyvj1098[luogu 2365]任务安排 batch

2.windows批处理-batch

Windows Batch:如何添加主机条目?