Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using the following command to list some of my favorite videos in a directory (and redirect the output into a text file):

for %i in (*avi *.mkv *mp4) do @echo %~ni

I'd like to alphabetically order the output of this command. I think I'd probably use sed or awk or something under Linux, but I'm on Windows 7 here using the command prompt (and soon, a batch file).

How would I achieve this (without using some external program or language)?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Just add sort

(for %i in (*avi *.mkv *mp4) do @echo %~ni) | sort
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.