V
V
Viktor2016-07-17 11:29:20
cmd/bat
Viktor, 2016-07-17 11:29:20

How to save in a text file the name of the current directory, where is the batch file?

I wrote a simple batch file that saves the name of the files located in the current directory, you need to substitute the path along which they are located for these files and save it all in a txt file

setlocal EnableDelayedExpansion
dir /b %path % > myFiles.txt

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2016-07-17
@kani339

If you add the /s switch to dir, then there will be full paths, but the contents of the subdirectories and the subdirectories themselves will appear. If there are no subdirectories, then this option is fine.
If there is, then you have to do in for:
for %%a in ("%pathdir%\*") do >>myFiles.txt echo.%%~fa

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question