[英]Adding file extensions to files without them in Windows
I am trying to add file extensions to a large number of files located in a series of folders and subfolders in Windows.我正在尝试向位于 Windows 中一系列文件夹和子文件夹中的大量文件添加文件扩展名。 For some reason, these files do not have a file extension on them and I need them to have the extension .ddd so I can convert them to PDFs using a separate program.
出于某种原因,这些文件没有文件扩展名,我需要它们具有扩展名 .ddd,以便我可以使用单独的程序将它们转换为 PDF。
cd R:\PRODUCTION\92
ren *. *.ddd
Note that this command does indeed work but only on folders that actually contain the files I need, and no subfolders.请注意,此命令确实有效,但仅适用于实际包含我需要的文件的文件夹,而没有子文件夹。 What could I add or change to hit all files in all subfolders?
我可以添加或更改什么来点击所有子文件夹中的所有文件? Thanks in advance.
提前致谢。
Please try the following command.请尝试以下命令。 If it looks like it will do the correct rename, remove the
ECHO
from the REN command line.如果它看起来会进行正确的重命名,请从 REN 命令行中删除
ECHO
。
CD /D R:\PRODUCTION\92
FOR /F "delims=" %f IN ('DIR /S /B /A:-D "*."') DO (ECHO REN "%~f" "%~nf.ddd")
In a .bat file script, double the percent character on the variable.在 .bat 文件脚本中,将变量上的百分比字符加倍。
CD /D R:\PRODUCTION\92
FOR /F "delims=" %%f IN ('DIR /S /B /A:-D "*."') DO (ECHO REN "%%~f" "%%~nf.ddd")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.