1 year ago
#76798
Alfred Graton
Make a txt for each folder without space at the end of the filename
Here is my code:
@echo OFF
for /d %%D in (*) do @echo %%~nxD >>List.txt
@ECHO ON
SET FileList=List.txt
FOR /F "TOKENS=*" %%F IN (%FileList%) DO (
ECHO ^0>"%%~F.txt"
)
GOTO EOF
My goal is to make .txt
files with the name of each folder. For example for a folder named Myfolder01
I want a Myfolder01.txt
file.
But with my code, each filename have a space at the end: Myfolder01 .txt
What in my code is wrong? I don't want a space at the end of the filename.
windows
batch-file
cmd
0 Answers
Your Answer