Pergunta

When I run the following line:

dir C:\FILENAME *.bat /b > C:\TEXTFILE.txt

I receive the following in the TEXTFILE.txt:

BATCHNAME.bat
BATCHNAME.bat

How can I make it output just the name of each file once?

Foi útil?

Solução

Use this:

dir C:\FILENAME\*.bat /b > C:\TEXTFILE.txt
               ^
     note the added backslash

Assuming you're in the c:\filename directory, your original command will get two copies because it's asking for two separate things.

Outras dicas

dir C:\FILENAME\*.bat /b > C:\TEXTFILE.txt

You are asking dir command to list two different sets of files, the content of C:\FILENAME and (there is a space between) the list of all .BAT files in current directory. So, two lines into the output file

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top