Batch: How to make a .txt file with all files in a folder without extensions
-
19-06-2021 - |
سؤال
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:
a.bsp
b.bsp
c.bsp
but i want it without ".bsp"
please help
المحلول
You need to read up on the FOR command - type HELP FOR
or 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"
لا تنتمي إلى StackOverflow