문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top