Print a list of directory contents

Posted on Thursday 4 October 2007

Print This Post Print This Post

The DIR command gives you the information you want, but it isn’t yet in a form you can use in a Windows document—you can’t copy and paste the contents of the DOS window. Instead, you’ll use another native DOS technique: output redirection. Rather than allow the DIR command’s output to appear onscreen as it does by default, you’ll send it to a text file. To do so, you’ll use the > redirection operator, like this:
dir/b /s > dirlist.txt

Of course, you can use any file name you like and you can precede it with a file path. When you press [Enter], you’ll simply see the command line reappear. However, if you close the DOS session by typing exit and you return to Windows, you’ll find a new text file that contains the file names


No comments have been added to this post yet.

Leave a comment

(required)

(required)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post | TrackBack URI