简体   繁体   English

批处理:如何制作包含没有扩展名的文件夹中的所有文件的.txt文件

[英]Batch: How to make a .txt file with all files in a folder without extensions

right now i have this code: 现在我有这个代码:

@echo off

dir Maps /A-D /b /o:gne >Maplist.txt

start notepad Maplist.txt

But i makes Maplist.txt like this: 但我像这样制作Maplist.txt:

a.bsp a.bsp

b.bsp b.bsp

c.bsp c.bsp

but i want it without ".bsp" 但我希望它没有“.bsp”

please help 请帮忙

You need to read up on the FOR command - type HELP FOR or FOR /? 您需要阅读FOR命令 - 键入HELP FORFOR /? from the command window to see the documentation. 从命令窗口查看文档。

The following code will do exactly what you want. 以下代码将完全按照您的要求执行。

@echo off
>Maplist.txt (
  for %%F in (Maps\*) do @echo %%~nF
)
start notepad Maplist.txt

Has speech marks annoyingly, I'm assuming you don't want those either? 有语音标记令人讨厌,我假设你不想要那些? (It does get rid of extension though) (尽管它确实摆脱了扩展)

forfiles /p files /c "cmd /c echo @FNAME >> maplist.txt"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何制作在当前文件夹中工作的批处理文件并删除特定文件? - How to make a batch file that works in the current folder and delete specific files? 如何使用BATCH文件为文件夹中的所有文件添加和删除后缀 - How to add and remove postfix for all files in folder using BATCH File 如何替换文件夹中的所有文件扩展名? (蟒蛇) - How to replace all the file extensions in a folder? (Python) 关于更改ubuntu 14.04中文件夹中所有文件的文件扩展名 - Regarding changing the file extensions of all files in a folder in ubuntu 14.04 读取特定文件夹中的所有txt文件并将所有内容写入一个txt文件 - Read all txt files in a specific folder and write all contents in one txt file 如何在CMD中的批处理“目录”脚本中排除输出filelist.txt中的文件扩展名 - How to exclude file extensions in the output filelist.txt, within a batch “dir” script in CMD 制作批处理文件,创建具有今天日期的文件夹,然后将文件从文件夹移动到新创建的文件夹 - make batch file that creates a folder with today's date then moves files from a folder in to that newly created folder 如何使用 spring-batch 和 MultiResourceItemReader 读取文件夹中的所有文件? - How to read all files in a folder with spring-batch and MultiResourceItemReader? 如何批量复制源文件夹和子文件夹中的所有文件 - How do I copy all files in the source folder and in the subfolders in batch 如何在Python中的目录中查找具有特定文件扩展名的所有文件 - How to find all files with specific file extensions in a directory in Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM