Domanda

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?

È stato utile?

Soluzione

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.

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top