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

Hello,

With

dir /a:d /s /b >>textfile.txt

I build a fantastic dir list in textfile.txt
The only thing I want different is a / added to the end of each line.

so in the file it will look like this:
C:\Program Files\
C:\Program Files\Nero\Nero 7\

Instead of this:
C:\Program Files
C:\Program Files\Nero\Nero 7

Thanks.

2007-04-24 18:55:27 · 2 answers · asked by Netiad 2 in Computers & Internet Programming & Design

2 answers

In this situation, the "dir" command won't be enough by itself.

There are two ways to tackle this.

1) Using one of the builtin switches of the "for" command. Notice that I'm echo'ing the variable %i plus an extra "\" into the textfile.txt

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

2) Use "for" with the output of the "dir" command that you've already built. Again, I'm echo'ing the extra "\" onto the end of each line.

for /f "tokens=*" %i in ('dir /ad /s /b') do @echo %i\>> textfile.txt

=========
NOTE: if you use either of these in a batch file, then any single % symbols need to be doubled into %%

Like this,


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

.or.

for /f "tokens=*" %%i in ('dir /ad /s /b') do @echo %%i\>> textfile.txt

2007-04-25 12:50:06 · answer #1 · answered by Kevin 7 · 5 0

In be conscious you may substitute all paragraph marks (^p) to character^pa956161a69928cd130a889b88082fb6e it will do each line however the commencing up of the 1st line. If not be conscious, you need to use any text textile editor which could do a replace via popular expression. in simple terms replace start off of line with start off of line and your character, and end of line with your character and end of line. or you may write a application to envision the record, line via line, and write a sparkling one with your character, the line, your character.

2016-10-30 06:00:04 · answer #2 · answered by ? 4 · 0 0

fedest.com, questions and answers