Tuesday 20 September 2016

How do I print a listing of files in a directory?

  1. Get to the MS-DOS prompt or the Windows command line.
  2. Navigate to the directory containing the content you'd like a list to print. If you're new to the command line, familiarize yourself with the cd command and the dir command.
  3. Once in the directory you want to print the contents of, type one of the below commands.
dir > print.txt
The above command takes a list of all the files and all of the information about the files, including size, modified date, etc., and sends that output to the print.txt file in the current directory.
dir /b > print.txt
The above command would print only the file names and not the file information of the files in the current directory.
dir /s /b > print.txt
The above command would print only the file names of the files in the current directory and any other files in the sub-directories within the current directory.
  1. After executing any of the above commands, the print.txt file is created. Open this file in any text editor (e.g. Notepad) and print the file. You can also print from the command prompt by typing notepad print.txt.

No comments:

Post a Comment