English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i need a batch file that when run on any windows operating system will create a text file of ALL folders.

not just dir /s >> textfile.txt

This needs to be in a for loop and when run ONCE it creates a list of ALL directory paths. Therefore the shouldn't be any cd command because we don't know the exact path of say c:\tim\fun

2007-04-23 15:25:20 · 3 answers · asked by Netiad 2 in Computers & Internet Programming & Design

3 answers

Using the "for" command is one option. Here's an easy one using the "dir" command with a few switches,

dir \ /s /b /ad > textfile.txt

"\" = start from the root directory
"/s" = get all subdirectories
"/b" = bare information, just names
"/ad" = just get directories

2007-04-25 12:42:30 · answer #1 · answered by Kevin 7 · 4 0

attempt from the c: instantaneous dir *. >dirlist.txt Folders have not got an extension to their call, as a result *. will instruct wildcard DOT entries contained in thechronic the report is parsable in a application if choose be, as i've got executed it as quickly as earlier. you additionally can use any of the DIR command switches. the > directs the output to the report named.

2016-12-26 21:25:09 · answer #2 · answered by ? 3 · 0 0

cd \
for /d /r %x in (*) do echo %x >> textfile.txt

dont forget to use %%x if running from a batch file.

2007-04-23 15:52:09 · answer #3 · answered by Amanda H 6 · 0 0

fedest.com, questions and answers