Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 1 down vote accepted

Just add sort

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .