Find and rename files with no extension?

后端 未结 3 869
感动是毒
感动是毒 2020-12-14 02:45

So, I\'ve got a bunch of files with no extension. I want to write a windows batch script that will:

  1. Find files with no extension (in a specified folder)
3条回答
  •  被撕碎了的回忆
    2020-12-14 03:20

    to do this in subdirectories use this:

     for /f %a in ('dir /b /ad /s') do rename %a\*. *.bla
    

    if you are using this in a batch file, you need to double the '%'

     for /f %%a in ('dir /b /ad /s') do rename %%a\*. *.bla
    

    edit:

    and if you have spaces in your directory names, you can try this (batch version):

     for /f "tokens=* delims= " %%a in ('dir /b /ad /s') do rename "%%a\*." "*.bla"
    

提交回复
热议问题