简体   繁体   English

在 Windows 中为没有文件扩展名的文件添加文件扩展名

[英]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.

相关问题 Windows CMD:列出dir和subdir中没有给定扩展名的文件 - Windows CMD: List files in dir & subdir WITHOUT given extensions Windows-文件扩展名操作 - Windows - file extensions manipulations Windows / NTFS:目录中的文件数,不枚举它们 - Windows / NTFS: Number of files in a directory, without enumerating them 将文件扩展名与具有可变扩展名的文件相关联 - Associating File Extensions to a files with variable extensions 在Windows的.txt文件中复制文件夹中的文件,但不包括其中的一些文件 - copy files in a folder excluding some of them from a .txt file in windows Windows Batch脚本可查找具有特定扩展名的文件,并将其目录写入文本文件 - Windows Batch script to find files with specific extensions, write their directories to a text file 重命名Windows批处理脚本中的多个文件扩展名 - renaming multiple files extensions in a Windows batch script 通过Windows批处理重命名具有不同扩展名的文件 - Rename files with different extensions via Windows batch Windows 批处理脚本,用于重命名文件以删除其扩展名 - Windows batch script for renaming files to remove their extensions Windows 命令获取文件扩展名列表 - Windows command to get list of file extensions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM