View command on the command line. Description of the DIR command

Using Windows CMD commands you can launch system utilities much faster than doing it the usual way. And, although not everyone understands the meaning of this text interface, considering it outdated, in fact the tool is quite useful.

And not only for professionals, but also for ordinary users. Although to run most commands, you should run the command line (cmd) as an administrator.

The need to use the command line

The cmd line, which is a standard tool on the Windows platform, is no different in different versions of operating systems - the seventh, the eighth, the tenth, and even XP. And all teams work the same way in each of them.

The advantage of using a line is that it speeds up the work - sometimes entering the desired command is much faster than searching for the corresponding file in the system folders. Moreover, to speed up work with CMD, a link to it can be displayed on the desktop - or even on the Quick Launch panel.

The disadvantages of the interface are:

  • manual command entry from the keyboard;
  • the need to run CMD as an administrator (most commands will not run otherwise);
  • a fairly large list of commands that are difficult to remember.

Externally, the command line is largely reminiscent of the DOS system interface. And, although it allows you to solve many more problems, some commands are the same as the outdated platform. For example, “format”, “cd” and “dir”, necessary for working with folders and drives.

Working with the interface

Before you start working with the command line, you must first launch it. There are several ways to do this:

  1. Open the “Run” menu (pressing Win + R at the same time) and enter the cmd.exe command;
  2. Go to the Windows folder on the system drive, open the System32 directory and run the file called cmd.exe. You can simplify the task by creating a shortcut that launches the same application and install it on the desktop;
  3. Open the Start menu, go to the All Programs section, then to the Accessories subsection and find the Command Prompt.

You should know: After the first launch through the Start menu, CMD appears at the top of it - in the list of most frequently launched applications and utilities. And you can open a line while working in any application (even in a game), just by pressing the Win button on the keyboard.

Rice. 1. Command line of the Windows operating system.

The standard view of the command line is a black window with white text. If this option does not suit the user, he can change the colors depending on his preferences.

To do this, right-click on the top of the window and go to CMD properties. In the window that opens, you can select the location of the line, the colors of the text or window, and even the font sizes. Here you can expand the interface to almost the entire screen, increasing the level of convenience of working with it.

Rice. 2. Change command line settings

Commands to help you work with CMD

Hotkeys help make using the command line even easier - although they are not the same as the usual Windows shortcuts. Instead of pressing the standard Ctrl + C and Ctrl + V typings, copying and pasting text is done as follows:

  1. Right-click on the selected line in the open CMD window;
  2. Select “Mark”;
  3. Select text using the left button;
  4. Right click again. After this, all information ends up in the operating system's clipboard.

In order to paste the copied information, press the same right button and select “Paste”. You can simplify copying data by checking the “Mouse selection” box in the command line properties.

After this, the text can be immediately selected with the left button. If you uncheck the quick paste box, the data is inserted on top of already written commands.

List of hotkeys

When working with the command line, use the following “hot keys”:

  • The up and down arrows allow you to move the cursor around the window, including commands that have already been entered;
  • Home and End move the cursor to the beginning and end of the line, respectively;
  • the left and right arrows together with the Ctrl key pressed simultaneously allow you to move the cursor in a given direction by an entire word;
  • Insert, as in any text editor, switches the modes of inserting text with a shift to the right and overwriting over written data;
  • Esc deletes the selected information;
  • F1 allows you to enter the last recorded command one character at a time;
  • F5 prints the previous command;
  • F7 lists the last few entries. By default, their number is 50.

Basic commands

The list of basic commands that most users need is relatively small and consists of commands that perform the following actions:

  • work with catalogs;
  • provide statistics on the operation of various applications, the network and the operating system as a whole;
  • restore driver functionality;
  • turn off the computer.

Using the command line, you can even format the drive (including the system drive, which cannot be formatted from a Windows system by any other means) and even stop the process. Also, using CMD, the user gets access to the registry editor and the system configuration window much faster.

Working with catalogs

The main command for working with directories is dir. With its help you can check the contents of an open directory. And, if you need to open another folder, you should additionally specify the path to it. For example, select “dir C:\” or “dir D:\”.

Rice. 3. Checking the contents of logical drive C.

The second command for working with directories is cd. With its help you can go to any selected folder. For example, by writing “cd C:\Windows” on the command line, go to the system directory. To open a folder on a disk that is already selected, issue a command like “cd /D D:\”.

Rice. 4. Transition from local drive C to drive D.

The mkdir command creates a new folder. And the parameter that is set after it determines the name of the directory. So, after entering “mkdir D:\New_Folder”, the corresponding directory appears on drive D. If the user specifies several directories in the list at once (for example, “E:\New\Games\Fallout_3”), an entire tree of folders can be created.

Rice. 5. Create a new folder from the command line.

Running the rmdir command allows you to delete a directory by specifying its full path. For example, by writing "rmdir D:\New_Folder", you can erase the newly created folder. Although, if there are other files inside the directory, a message appears on the screen indicating that it is not empty. You can delete a non-empty folder by entering the command rmdir /S in the line. Before deleting, select “Y” (Yes), confirming your action.

Rice. 6. Deleting a folder using the rmdir command.

Turning off the computer

Using the shutdown command, you can turn off the computer - either immediately or by setting a timer:

  • shutdown /s simply stops the operating system, closing all unfinished processes;
  • When you select the shutdown /s /t 3600 command, the timer will be set to exactly one hour. If you need to set any other time, the corresponding number of seconds is written instead of 3600;

Rice. 7. Enable automatic shutdown of the system.

  • To cancel an already set timer, enter the shutdown /a command.

Rice. 8. Cancel shutdown.

The commands work the same on any operating system. The only difference is in the inscriptions that appear. For example, for Windows 7, messages are located in the lower right corner of the desktop.

View statistics

Viewing computer statistics begins with the systeminfo command. It provides the maximum amount of information about the Windows system. Although, to obtain information, it is more effective to use special applications rather than a system utility.

For example, AIDA64 is a universal program for collecting information, the only drawback of which is its shareware license. A month after use, you will have to pay for the utility - from 1400 to 2200 rubles. per computer, depending on the number of licenses purchased.

Rice. 9. Obtaining information about the computer and operating system.

The driverquery utility allows you to view a list of drivers and their properties. In the list that appears on the screen you can see the type of control program, the reference date and the name of the module.

Rice. 10. Display a list of drivers.

A utility called pathping, when run, shows information about the data lost during transmission between the starting and ending points. This command calculates loss ratios for different routers. And based on the results of the utility’s work, they identify access problems for individual routers.

Rice. 11. A utility that checks network operation.

The Netstat application shows information about active connections and statistics for various network protocols. When you run the command without specifying specific parameters, only TCP connections are displayed.

Rice. 12. Checking active TCP connections.

The tasklist command displays a list of all processes running on the system. With its help, you can view data received from a remote computer. Although, if additional parameters are not specified, information is displayed only about the current device.

The ipconfig utility displays information about the IP address and other parameters of the network adapter. Along with the command, additional parameters are used - for example, /all, which allows you to obtain information about each of the adapters.

Rice. 13. Obtaining information about network connections.

Changing system settings

The msconfig utility allows you to call up a menu that allows you to change the operating system configuration:

  • a list of programs that automatically load with the system;
  • launch options;
  • Windows boot options.

Most often, the command is used to remove or add an application to the startup tab. And sometimes they make changes to the loading order of operating systems - if two of them are installed on the computer (for example, Windows 10 and Windows XP, each of which may be more convenient for a particular user).

Rice. 14. Calling the menu for changing the system configuration.

Running the regedit utility allows you to open the system registry editor - one of the most useful applications with which you can get rid of the remnants of deleted programs, make changes to the operation of services and fix problems. It is worth noting that changing any values ​​(not to mention deleting) must be done very carefully. Errors in the registry can lead to system crashes and even reinstallation. Read also our material: TOP 3 programs for cleaning the Windows 7 registry.

Rice. 16. Start checking files on the system disk.

The format command, which has not changed for decades, allows you to format any disk, including USB flash drives. Selecting “format C:” formats the system partition. And with additional parameters, you can define the file system (/fs), set the volume label (/y), and even assign cluster sizes (/a). Without specifying certain conditions, the cluster is installed automatically.

Rice. 17. Formatting the H drive via the command line.

Stopping processes

Using a command, you can stop a specific process. For this, an identifier can be used (for example, 2616, if we are talking about the Paint graphic editor) and the /pid parameter. In addition, when stopping, the name of the process itself and another parameter /im can be used. The same editor is closed with the command taskkill /im MSPaint.exe.

Rice. 19. A utility that restores damaged system files.

Clearing the screen

After executing several commands, the window is filled with text, which may interfere with further work. You can get rid of unnecessary data using the CLS (Clear Screen) command. After launching it, the screen is completely cleared, leaving room for further user actions.

conclusions

With constant use of basic commands, they are easily remembered by the user. And in order to learn about new utilities or remember the names of old ones, you need to enter /help on the command line. A list of possible commands will appear on the screen, which are unlikely to be useful for the average user, but can simplify the work of local network administrators.

Windows for communicating with the computer in a language it understands. However, programs are still launched using the regular command line (console). It is the founder of the interface and a means of communication between the user and the PC. The essence of the work is that commands are entered into a line using the keyboard. This management method is often used by system administrators. Regular users should also know basic commands.

Console - what is it?

Windows programs are launched using the console - the command line. This is one of the types of text interface that has become available to many MS DOS users. Commands are entered into the command line manually. Many people consider the console to be an outdated management method, which is often needed by users and system specialists. The command line is a black window with a green location label and a blinking cursor. The corresponding command for the computer is entered into the specified location.

The Command Prompt is an incredibly convenient window for solving many problems. However, to interact with the console you will need knowledge of writing commands. The advantage is that they reduce the time required to complete complex actions. To do this, just enter the desired task in the line.

Why are teams needed?

Command line commands are necessary to establish user interaction with the operating system and computer. Working with the command line is an urgent need for specialists who are involved in system administration. The console is a small part of what you can use as a tool to work with Windows. The command line is convenient, fast, and can be used to easily solve many issues. To work with it, you will need knowledge of commands and skills that will lead to a positive result.

CMD - there are a huge number of commands. Practice will help you remember the main ones. Using commands, you can change, edit files, create, restore partitions, configure, run, restart the computer, delete folders, copy and much more. Experts advise making a list of important commands in alphabetical order in a notepad. It's convenient and helps you quickly find your way around.

How to start?

Windows command line commands run without much difficulty. Despite the graphical interface, the console has always been and is the main element of computer control. The basics of working with the console will be useful to the average user. To launch the command line, open the menu: “Start” - “Run”. Enter the word “Cmd” in the window that appears, press “Enter”. If the version of the operating system does not have the “Run” item, then the combination “Win ​​+ R”.

In Windows 7, right-click on “Start”, go to “Properties” - “Customize”, check the box next to “Run”. If you need to open the console as an administrator, enter the command “Cmd” in the “Start” search bar, right-click on the “Cmd” program, select “Run as administrator.” It is convenient to create a shortcut on the desktop that will open the console. The appearance of the line window can be changed according to the user's wishes (color, font, location).

Sometimes you may have problems copying and pasting text into the command line. In the case of the console, the clipboard buttons do not work. If you need to make a copy, right-click on the window, select "Mark", select the text with the left mouse button, and then right-click. To insert text or text, right-click the Paste command line window. In addition, you can work with the console using hot keys on the keyboard and the up/down arrows.

Basic

The main commands for the command line help the user to solve tasks of paramount importance in a short time.

Additional

The list of commands, which is auxiliary, is often used by system specialists to work with information located on the hard drive.

  • The “Format” command deletes data from the hard drive and prepares it for copying. As an example of a formatting command: “FORMAT disk:/FS:FAT (file system).”
  • The "FC" command compares files with each other.
  • “IPCONFIG” - shows complete information about the Network settings, and also reports the type of network connection “IPCONFIG/ALL”.
  • The PING command will check the site's availability. Example: “PING fb.ru”. The presence of numbers in the response indicates that everything is in order and the site is available for visiting.

Commands for the Network

Web command line commands let you surf the Internet efficiently, fix errors, and configure settings. If you need to find out your IP address, enter the “Ipconfig” command in the console. In different variations of Internet connection, you can find out complete information about the Network. After entering, the user will receive a list of network connections that are used by the computer. If the user's computer is connected to the Internet via Wi-Fi, the main gateway will be selected to communicate with the router. The user can access its settings through a command entered into the console. If the computer is connected to a local network, you can find out about the IP address through the command line with the corresponding request.

Using the “Ping” and “Tracert” commands, the user can quickly find and fix problems with the Internet and browser. The "Netstat-an" command displays network connections and ports. This is a very useful program because it displays various network statistics. The "-an" switch opens a list of available network connections, ports and IP addresses. The “Telnet” command connects to servers of the same name. If you need to get information about network settings, use the "Ipconfig" command. Without additional parameters, the command displays information about the IP address. If you need specific information, add the “All” command. Entering “Ipconfig/flushdns” into the line clears the cache in Windows.

Filters

Filters are command line commands that are used with the pipe redirection symbol. They are needed to sort, view and select information from other teams. Filters organize, divide, and highlight part of the information that passes through them. Among these commands are the following:

  • “More” - displays the contents of the file;
  • “Find” - searches for specified characters;
  • “Sort” - sorts files alphabetically.

In order to send data from a file, the “L” symbol is used, and the “I” channel is used to send data to the output.

Shutdown

In addition to the built-in CMD, the console is used to launch ordinary programs. In order to enter it, just type the desired combination of letters in the “Run” window. If you need to view the results, it is better to use a string. “SHUTDOWN” is a command that shuts down Windows if for some reason the Start button does not work. It is useful when the computer is performing a task that cannot be interrupted (and the user needs to leave and not leave the computer on for a long time). The device will turn off correctly upon completion of work on its own. It's better than setting a timer.

Type the following command “Shutdown-s-t-1300”, press “Enter”. The numbers are the time in seconds after which the device will turn off. The command to restart the computer from the command line is as follows: "Shutdown -r". Click "Confirm" to activate. “At” command - starts the PC at the time specified by the user. This utility reads and groups jobs in the Windows operating system.

Formatting

The list of commands for the console is huge. Many of them are harmless and simple, but there are special ones among them that require caution on the part of the user. Be careful! Sometimes it is necessary to completely format a disk or flash drive. The command to delete all data looks like this: “Format C”, auxiliary parameters “/fs” - determine the location of the file system of the formatting disk, “/v” - sets the volume label, “/a” - the cluster size. Do not execute the formatting command if you are not sure of your actions and do not know why it is needed. The command deletes all information from the PC!

Examination

Some command line commands are designed to check disks for system errors. The “CHKDSK” command without additional parameters displays information about the status of the hard drive. If errors are found, enter an additional “/f” to correct them. Before checking the drive, lock it. If the console is full of commands, enter “c/s” into the line to clear the screen.

The system files will be checked by the “Sfc” command. With its help you can recover damaged files. The command is supplemented with the parameters “/scannow”, “/scanonce”, “/scanboot”, which check and correct system errors in files.

Other

It is impossible to know all the commands on the line, but some of them will be useful to the user. For example, the "Assoc" command changes the association between extension and file type. If the user wants to find out detailed information about the operating system and the state of the computer, he should type “Systeminfo”. Using the system registry editor "Regent" you can change hidden OS settings. However, if you don’t know what’s what, it’s not recommended to do this due to the risk of breaking Windows. It is easy to call the system configuration - a special service by entering "Msconfic" into the command line. If you want to learn more about the commands, write “Help” in the console line, taking into account that the operating system is the seventh or eighth version of Windows.

Experts include network, system and filters as useful commands for the user. The "At" command consists of a whole set of commands that are used to install, reinstall, and configure the modem. It is also considered a team planner. With its help, you can change, cancel, configure tasks for a remote or local computer. In the Windows operating system, it is better to use the "SCHTASKS" utility instead of the "At" command. Its capabilities are much wider.

I recently grew from a fierce nerd in a very large company to a modest system administrator overseeing a network of 10 PCs. And, like a very lazy system administrator, I was faced with the task of automating my activities. Six months ago, I didn’t yet know that there were pipelines in the Windows command line. This was the first shocking discovery. And I went further, and it turned out that where I had previously written utilities in C#, Delphi or cumbersome scripts with nested loops, I could get by with a couple of forfiles or robocopy commands.
I won’t talk about banalities, such as listing files and folders using the Tab key. Under the hack I’ll tell you about what can be useful for novice admins and enikeys.

Hotkeys
Let's start with hotkeys, because first we need to explore what the work environment can give us.

F1- In the console, this key works exactly like the right arrow, i.e. displays one character at a time from the last command entered (or selected in the history).
F2+<символ> - Prints the last command entered up to the specified character. For example, if the last command you entered looked like this:
ping 192.168.25.1
then after pressing the key combination F2+5 You'll get:
ping 192.168.2
F3- Displays the last, and only the last, command in its entirety.
F5- Displays the last commands entered in order, just like the up arrow.
F6- Inserts the EOF character at the current command line position, which is the same as pressing Ctrl + Z.
F7- A dialog box containing the command history.

Alt+F7- Clears command history.
<символ(ы)>+ F8- Iterates through commands that begin with characters already entered into the command line.
If before pressing F8 do not enter anything, then this key will work like the up arrow, but with a slight difference - the lines will be cycled through, i.e. after the first command from the list the last one will be displayed.
F9+<число> - Inserts a command from history under the corresponding number. For example, in the situation shown in the screenshot above, when you press the combination F9+4 the following will appear in the console:
ipconfig

Command Line Operators
A long time ago, when I was little, I couldn’t even imagine how you could work in a console without a graphical interface. After all, the output of commands sometimes takes dozens of pages, and if you need to select some data from there, then page-by-page output will not save you. But one day I installed FreeBSD on my old computer, opened the handbook and was simply dizzy with the possibilities that opened up. There you can redirect the output of a command to the input of another command and this is called a pipeline.

The pipeline operator in *nix and cmd is the vertical bar character.
For example, the command will display all text files in the current folder
dir | find ".txt"

Command concatenation operator
&
Example: Command1 & Command2 – Command1 will be executed first, and only then Command2
Operator AND
&&
Example: Command1 && Command2 - Command2 will only be executed if Command1 succeeded
OR operator
||
Example: Command1 || Command2 - Command2 will only be executed if Command1 failed to execute.

Parentheses are used to group commands, examples:

  • (Command1 & Command2) && Command3 – If Command1 and Command2 are executed successfully, Command3 will be executed.
  • (Team1 & Team2) || Command3 - If Command1 and Command2 are not executed, Command3 will be executed.

Thank you for your attention! I'm waiting for criticism and suggestions...

UPD1
For those who are not in the know, circumflex (that “^” sign) means pressing the Ctrl key (^C = Ctrl +C).

^C - Interrupts the command, well, everyone knows that.
^S - Pauses the command and then runs it.
^I - Analogous to Tab, iterates through folders and files.
^M - Analogous to Enter.
^H - Analogous to Backspace.
^G - By writing the command echo ^G in a batch file, you can beep the system speaker (speaker).
(The commands ^I and ^H were obtained by me using the “scientific poke” method; there is also ^J but I don’t know what it does)

P.S. Other subtleties of the Windows command line have already been repeatedly covered on Habré. And I don’t see the point in copy-pasting.
P.P.S. Links to interesting posts and articles on other Windows command line features.

Command line or as it is also called cmd in the Windows 8 operating system is the same as in younger versions of Windows 7, Windows Vista, Windows XP, it follows that the same commands work the same in all versions.

So let's first figure out how to launch the command line. To do this, you must have a working computer with an operating system.

Some commands, if you are running under a regular user account, may not have enough rights to execute them for security reasons, so always run the command prompt with administrator rights. There are 2 ways to launch the command line:

In the window that appears, write cmd and click OK.

A command prompt window will open with a black background.

2) A faster way: through the hot keys Win + R, here also in the window that appears we write cmd, press ok.

In Windows 8, you can only use method 2, since there is no Start menu. Let's write our first help command, which will display a list of all available commands with brief explanations.

List of all existing Windows command line commands:

ASSOC Print to screen or modify mappings based on file name extensions.
ATTRIB View and modify file properties.
BREAK Locks or unlocks enhanced CTRL+C processing in DOS.
BCDEDIT Sets properties in the boot database that allows you to control the initial boot.
CACLS Lists data and modifies access control lists (ACLs) on files.
CALL Calls one batch file from another, and can also pass input arguments.
CD
CHCP Output or set encoding.
CHDIR Displays the name or moves to another folder.
CHKDSK Diagnostics of the drive for errors.
CHKNTFS Shows or changes drive diagnostics during boot.
CLSO clearing the display of all symbols.
CMD Launches a Windows command line program. You can run an infinite number of them on one computer. They will work independently of each other.
COLOR Changes and sets the main background of the window and the fonts themselves.
COMP Shows differences and compares the contents of two files.
COMPACT Changes and shows file compression in NTFS.
CONVERT Converts FAT disk volumes to NTFS. The current drive cannot be changed.
COPY Creates a copy of a file or files and places them in the specified location.
DATE Shows or sets the current date.
DEL Destroys one or more files at once.
DIR Shows the names of files and folders with their creation date located in the current folder or specified in the folder settings.
DISKCOMP Compares and shows the differences between 2 floppy drives.
DISKCOPY Creates a copy of the contents of one floppy drive to another.
DISKPART Shows and changes the properties of a disk partition.
DOSKEY Modifies and re-invokes command lines; creates macros.
DRIVERQUERY Displays information about the status and attributes of a device driver.
ECHO Displays text information and changes the display mode of commands on the screen.
ENDLOCAL Brings the environment localization to a close for the batch file.
ERASE Destroys a file or files.
EXIT Terminates the command line program
F.C. Shows the differences between two files or two sets of files and also compares them
FIND Searches for a text string in files or in one file.
FINDSTR Advanced search for text strings in files.
FOR Cycle. Repeats execution of the same command a specified number of times
FORMAT Formatting the drive for use with Windows.
FSUTIL Shows and sets file system attributes.
FTYPE Allows you to change and view file types, which are mainly used when matching by file name extensions.
GOTO Transfers control to another specified command.
GPRESULT Displays Group Policy information for a computer or user.
GRAFTABL Allows Windows to display extended characters in graphical mode.
HELP Lists all data about existing Windows commands.
ICACLS Shows, modifies, archives, or restores ACLs for files and folders.
IF Executes commands based on a given condition.
LABEL Creates, modifies, and destroys volume labels for drives.
M.D. Creates an empty directory.
MKDIR Creates an empty directory.
MKLINK Creates symbolic and hard links
MODE Configures system devices.
MORE Sequentially displays information in blocks the size of one screen.
MOVE Moves files from one location to another.
OPENFILES Shows files that are open on a shared folder by a remote user.
PATH Displays or sets the full path to executable files.
PAUSE Stops execution of command line commands and displays information text.
POPD Restores the previous active folder value that was saved using the PUSHD command.
PRINT Prints the contents of a text file.
PROMPT Modifies the Windows command line prompt.
PUSHD Saves the active folder value and moves to another folder.
R.D. Destroys a directory.
RECOVER Revives readable data from a bad or damaged hard drive.
R.E.M. Places comments in batch files and the CONFIG.SYS file.
REN Changes the name of both files and folders.
RENAME Similar team REN.
REPLACE Swaps files.
RMDIR Destroys a directory.
ROBOCOPY Advanced tool for copying files and entire folders
SET Shows, sets, and destroys Windows environment variables.
SETLOCAL Localizes environment changes in a batch file.
S.C. Allows you to work with services
SCHTASKS Allows you to run any programs and sequentially execute the necessary commands according to a given plan
SHIFT Changes the position (shift) of substituted parameters for a batch file.
SHUTDOWN Shuts down the computer.
SORT Sorts input according to specified parameters.
START Launches a program or command in a new window.
SUBST Assigns a drive name to the specified path.
SYSTEMINFO Displays information about the operating system and computer configuration.
TASKLIST Shows a list of all running processes with their IDs.
TASKKILL“Kills” or stops the process.
TIME Sets and displays the system time.
TITLE Sets the window name for the current session of the command line interpreter CMD.EXE
TREE Displays drive directories in a convenient visual form.
TYPE Displays the contents of text files.
VER Displays brief information about the Windows version.
VERIFY Checks for file writing errors on the drive.
VOL Displays the labels and serial number of the drive volume.
XCOPY Creates a copy of files.
WMIC Prints WMI on the command line.

If you ever need to get a list of all files, then you will find the most unpleasant news. The Windows Explorer interface doesn't allow you to do this in a simple and clear way. And the task seems to be incredibly simple, and all the necessary files seem to be in front of your eyes, but... However, this can be done very simply using the command line (cmd). Additionally, the command line will allow you to filter only the necessary files, for example only mp3s. In this case we will use the special command "dir". Most likely, experienced users are familiar with this command, so the article will not be interesting to them. But, for most ordinary users it will be very useful.

Note: you can also use various catalogers and organizers, but they require the installation of additional applications.

If you think that this will never be useful to you in your life, then you are mistaken. Almost every user implicitly uses file lists every day. This includes searching for the required document among all your documents. It `s music. These are photographs. These are various file exports in your applications. Trite, same playlist. It’s just that you’ve never encountered such simple tasks as “send a list of files, for example, to technical support”, “collectively select the music you need from the entire list” (and this is usually done on paper, and there are a huge number of “fashionable devices”, but they will never replace such simple things as paper and pencil), “upload a list into a new application” (not all applications have high-quality import), “using the same console applications for technical needs” (for example, various batch processing of files; of course, the average user will never do this, but...) and much, much more.

Display a list of files in a folder and its subfolders on the command line screen

  • Open a command prompt in the desired folder ()
  • Type "dir" (without quotes) and press Enter. You will receive a list of files (see picture)
  • If you need to list files in all subfolders, then instead of "dir" use "dir /s" (enter without quotes)

The resulting lists can be quite long, especially if the list is created for some large directories. Such lists will not fit on the screen, and it will not be very convenient to work with them. Fortunately, you can very easily save the entire resulting list into a separate text file.

Create a text file with a list of files on the command line

  • Open a command prompt in the desired folder.
  • Type "dir > listmyfolder.txt" (without quotes) and press Enter. The entire list will be saved in the file "listmyfolder.txt".
  • If you need to also save files from all subdirectories, then use the command "dir /s > listmyfolder.txt" (without quotes)

The file "listmyfolder.txt" will be created in the same folder you are in. A small clarification about the file, you can call it whatever you like, give it absolutely any extension. There are no special restrictions, except for those that the Windows system requires for file names. You can also use full paths to save the list in another directory. For example, you want to save a file on the "F:" drive in the "list" directory. To do this, you will need to use the following command: "dir > F:\list\listmyfolder.txt" (without quotes). As you can see, there is nothing complicated.

Create a text file with a list of files of a specific extension on the command line

You don't always need to get all the files in a directory. For example, you want to get only a list of photos or only music. Agree that manually changing the complete list of files is a boring and routine task. To make life easier for everyone, the command line supports a special character *, with which you can create so-called regular expressions (sometimes called a mask). Don’t be afraid of scary words; you won’t come across any complex constructions in the “/d+?[\.2345]?d+[\.]?mp3/$” variant. Next we will give simple examples of how you can get lists of all your mp3 and jpg files, i.e. music and photos.

Getting all mp3 files in a folder and all subfolders from the command line

  • dir /s *.mp3 > listmp3.txt

The file "listmp3.txt" will contain a list of all your MP3 files.

Getting all JPEG photos in a folder and all subfolders from the command line

The command now looks like this:

  • dir /s *.jpg > listjpg.txt

The file "listjpg.txt" will contain a list of all your photos in JPEG format.

Getting a simple list format from the command line

The above commands will generate lists that will additionally include information about the files, namely the size and creation date. But such information is not always necessary. Sometimes we just need a simple list of files. To generate such a list, you need to add the special parameter "/b" to the command. As a result, the command will look like this:

  • dir /s /b *.jpg > listjpg.txt

If you're interested, there are many other useful commands. To find out the full list of commands, you need to enter the command "help". Of course, a short description of the command is unlikely to help you imagine how the command can be used. That's why there is a special parameter "/?". If you enter it immediately after the command, a small manual on using the command and its parameters will appear in the console window.

Warning: If you are not very versed in what exactly the command does, then we strongly recommend that you first read about its use, at least in a search engine. Careless and incorrect use of commands can lead to unpleasant consequences. Of course, you can use disk images before tests, but you must agree that this is very expensive.


  • How to open Command Prompt in Windows 7/Vista as Administrator?

Technical Tips