[英]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 FOR
或FOR /?
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.