Windows Command Line Basics. Windows Command Line Basics Creating Command Line Scripts

Team HELP allows you to get help information about the most common commands in operating systems of the Windows family. Help information is displayed both for internal shell commands (IF, GOTO, etc.) and for standard command line utilities (BCDEDIT, CHKDSK, etc.). To get help on a specific command, use the command line:

HELP command

HELP IF- display help information about using the command IF
HELP assoc > C:\assochlp.txt- display help information about using the command assoc with output of results to a text file C:\assochlp.txt

Team HELP without parameters, displays a list of commands supported in this version of the operating system. For example for Windows 7:

ASSOC- Display or change mappings based on file name extensions.

ATTRIB- Display and change file attributes.

BREAK- Turn on and off the CTRL+C key combination processing mode.

BCDEDIT- Sets properties in the boot database to control the initial boot.

CACLS- Display and edit access control lists (ACLs) for files.

CALL- Calling one batch file from another.

CD

CHCP- Display or set the active code page.

CHDIR- Display the name or change the current folder.

CHKDSK- Checking the disk and displaying statistics.

CHKNTFS- Display or change whether disk check is performed during boot.

CLS- Screen cleaning.

CMD- Launch another Windows command line interpreter.

COLOR- Set default foreground and background colors.

COMP- Compare the contents of two files or two sets of files.

COMPACT- Display and change file compression on NTFS partitions.

CONVERT- Convert FAT disk volumes to NTFS. The currently active drive cannot be converted.

COPY- Copy one or more files to another location.

DATE- Display or set the current date.

DEL

DIR- Display a list of files and subfolders from a specified folder.

DISKCOMP- Comparison of the contents of two floppy disks.

DISKCOPY- Copying the contents of one floppy disk to another.

DISKPART- Display and configure disk partition properties.

DOSKEY- Editing and re-calling command lines; creating macros.

DRIVERQUERY- Displays the current status and properties of the device driver.

ECHO- Display messages and switch the display mode of commands on the screen.

ENDLOCAL- End of local environment changes for batch file.

ERASE- Delete one or more files.

EXIT- Shutting down the CMD.EXE program (command line interpreter).

F.C.- Compare two files or two sets of files and display the differences between them.

FIND- Search for a text string in one or more files.

FINDSTR- Search for strings in files.

FOR- Run the specified command for each of the files in the set.

FORMAT- Formatting the disk to work with Windows.

FSUTIL- Display and configure file system properties.

FTYPE- Display or change the file types used when matching by file name extensions.

GOTO- Transfer control to the marked line of the batch file.

GPRESULT- Display Group Policy information for a computer or user.

GRAFTABL- Allows Windows to display extended characters in graphics mode.

HELP- Displays help information about Windows commands.

ICACLS- Display, modify, archive or restore ACLs for files and directories.

IF- Operator for conditional execution of commands in a batch file.

LABEL- Create, change and delete volume labels for disks.

M.D.- Create a folder.

MKDIR- Create a folder.

MKLINK- Creating symbolic and hard links

MODE- Configuring system devices.

MORE- Sequential data output in parts the size of one screen.

MOVE- Move one or more files from one folder to another.

OPENFILES- Display files opened on a shared folder by a remote user.

PATH- Displays or sets the search path for executable files.

PAUSE- Pauses the execution of the batch file and displays a message.

POPD- Restores the previous active folder value saved using the PUSHD command.

PRINT- Prints the contents of a text file.

PROMPT- Changes the prompt in the Windows command line.

PUSHD- Saves the active folder value and moves to another folder.

R.D.- Deletes a folder.

RECOVER- Recovers readable data from a bad or damaged disk.

R.E.M.- Places comments in batch files and the CONFIG.SYS file.

REN

RENAME- Renames files or folders.

REPLACE- Replaces files.

RMDIR- Deleting a folder.

ROBOCOPY- Improved tool for copying files and directory trees.

SET- Shows, sets and removes Windows environment variables.

SETLOCAL- Starts localizing environment changes into a batch file.

S.C.- Displays and configures services (background processes).

SCHTASKS- Executes commands and runs programs according to schedule.

SHIFT- Changing the position (shift) of substituted parameters for a batch file.

SHUTDOWN- Local or remote shutdown of the computer.

SORT- Sorting input.

START- Execute a program or command in a separate window.

SUBST- Assigning a disk name to a given path.

SYSTEMINFO- Display information about the system and computer configuration.

TASKLIST- Displays all running tasks, including services.

TASKKILL- Termination or stop of a process or application.

TIME- Display and set the system time.

TITLE- Assigning a window title for the current session of the CMD.EXE command line interpreter.

TREE- Graphical display of the directory structure of a disk or folder.

TYPE- Display the contents of text files.

VER- Display information about the Windows version.

VERIFY- Setting the mode for checking the correctness of writing files to disk.

VOL- Displays the volume label and serial number for the disk.

XCOPY- Copying files and directory trees.

WMIC- Display WMI information in an interactive environment.

To output the list to a text file, you can use command output redirection:

HELP > myhelp.txt

The list contains the most common commands, most of which are present in all operating systems of the Windows family (TIME, DATE, COPY...). Some of the commands are built-in commands CMD.EXE(REM, COLOR, etc.), but most are command line utilities included in standard distributions. The list obtained using HELP does not contain even half of the commands that are included in modern versions of Windows operating systems. When you try to use HELP to get help information for a command that it does not support, for example help reagentc, the message is displayed:

This command is not supported. Use the "reagentc /?" parameter.

That is, in addition to the team HELP it is possible to obtain help information using a command line parameter /? or -? :

reagentc/?- display a hint for using the Windows Recovery Environment setup command REAGENTC, which is not supported by HELP help.

This article will cover the basics Windows command line, namely:

  • Command line concept;
  • Shell Commands Reference;
  • Sequence of events when executing a command;
  • Creating command line scripts;
  • Controlling the display of text and commands;
  • Commands for studying system information;
  • Commands for using the registry;
  • System services management;
  • Reboot and shutdown systems from the command line;
  • Manage applications and processes from the command line.

Command Line Concept

Command line support is built into the Microsoft Windows operating system and is accessible through a command shell window. The Command Prompt is supported in all versions of Windows and is used to run built-in commands, utilities, and scripts. Despite the power and flexibility of the Command Prompt, some Windows administrators never use it. If you have enough graphical administration tools, you can only use them by clicking the user interface elements.

However, experienced Windows administrators, qualified technical support specialists and advanced users cannot do without the command line. Knowing how to properly use the command line—specifically, which command line tools to choose and how and when to use them so that they work effectively—can help you avoid many problems and ensure smooth execution of your operations. If you support multiple domains or networks, understanding time-saving ways to work with the command line is not only important but necessary to automate daily operations.

With each new version of Windows, the command line has been improved and its capabilities expanded. The command line has undergone significant changes, associated not only with increased productivity, but also with increased flexibility. Now you can use the Windows command line to solve problems that could not be solved in previous versions of Windows.

The Windows command shell environment is launched in different ways, in particular by specifying parameters when running Cmd.exe or using its own startup file stored in the directory %SystemRoot%\System32.

Additionally, the command line can be run in batch mode to execute a set of commands. In batch mode, the command line reads and executes commands one after another.

When working with the Windows command line, you need to understand where the commands you use come from. “Native” commands (built into the operating system) come in two types:

  • Domestic– exist inside the command shell, they do not have separate executable files;
  • External- implemented in separate executable files, which are usually stored in the %SystemRoot%\System32 directory.

Quick reference to shell commands (Cmd.exe)

  • assoc- displays or modifies mappings ( associations) file types;
  • break— sets breakpoints when debugging
  • call— calls a procedure or another script from a script;
  • cd (chdir) - shows the name of the current directory or changes the current directory;
  • cls— clears the command line window and screen buffer;
  • color— sets the text and background colors of the command shell window;
  • sorry— copies files or performs file concatenation;
  • date— shows or sets the current date;
  • del (erase) — deletes a specified file, group of files, or directory;
  • dir— shows a list of subdirectories and files in the current or specified directory;
  • echo— displays text in the command line window or sets whether commands should be displayed on the screen (on|off);
  • endlocal— marks the end of localization ( local scope) variables;
  • exit— exit the command line shell;
  • for— executes the given command for each file in the set;
  • ftype Lists or changes current file types in file extension mappings to programs;
  • goto— specifies that the command interpreter should go to the line with the given label in the batch script;
  • if— executes commands according to conditions;
  • md (mkdir)— creates a subdirectory in the current or specified directory;
  • move— Moves a file or group of files from the current or specified source directory to the specified directory. Can also rename a directory;
  • path— shows or sets the command path used by the operating system when searching for executable files and scripts;
  • pause— stops the execution of a batch file and waits for keyboard input;
  • popd— makes current the directory whose name was saved by the PUSHD command;
  • prompt— specifies what text should be shown in the invitation line;
  • pushd— saves the name of the current directory and, if necessary, makes the specified directory current;
  • rd (rmdir)— deletes a directory or a directory along with its subdirectories;
  • rem— marks comments in a batch script or Config.nt;
  • ren (rename)— Renames a file or group of files;
  • set— shows the current environment variables or sets temporary variables for the current command shell;
  • setlocal— marks the beginning of localization ( local scope) variables in batch scripts;
  • shift— shifts the position of replaced parameters in batch scripts;
  • start— launches a specified program or command in a separate window;
  • time— shows or sets the system time;
  • title— sets the title of the command shell window;
  • type— shows the contents of a text file;
  • verify— turns on the mode for checking files after writing to disk;
  • vol— shows the label and serial number of the disk volume.

The syntax of any internal command ( and most external) can be obtained by entering the command name and /? at the command line, for example:

Command shell- a very powerful environment for working with commands and scripts. The command line allows you to run different types of commands: built-in commands, Windows utilities, and command-line versions of applications. Regardless of the type, every command you use must follow the same syntax rules. According to these rules, the command name is followed by required or optional arguments. Additionally, arguments can use input, output, or standard error redirection.

Sequence of events when executing a command

  • The command shell replaces any variables entered in the command text with their current values;
  • If a group or chain of several commands is entered, the line is split into individual commands, which in turn are split into the command name and arguments. Next, the commands are processed separately;
  • If a command name specifies a path, the shell looks for the command in that path. If there is no such command in the specified directory, the shell returns an error;
  • If the command name does not include a path, the shell first tries to resolve the command name internally. If an internal command with the same name is found, then an internal command has been called and can be executed immediately. If there is no internal command with the same name, the shell first looks for the command's executable file in the current directory, and then in the directories listed in the PATH environment variable. If the command file is not in any of these directories, the shell returns an error;
  • If the command is found, it is executed with the given arguments and, if necessary, input is read from the source specified in those arguments. Command output and errors are shown in the Command Prompt window or sent to a specified output and error sink.
  • As you can see, many factors affect command execution, including command paths, I/O redirection, and grouping or chaining of commands.

When working with a command shell, you probably started it by opening the Start menu ( Start) and selecting Programs ( Programs) or All Programs ( All programs), then Accessories ( Standard) and Command Prompt ( Command line). Other ways to start the command line are the Run dialog box ( Starting the program) or typing cmd in another, already open command shell window. These methods allow you to specify arguments when starting the command line: switches that control the operation of the command line, and parameters that initiate the execution of additional commands. For example, you can start a command shell in silent mode ( i.e. disable echo output) with the cmd /q command or to make the command shell execute the given command and exit - to do this, enter cmd /c, followed by the command text in quotes.

The following example starts a command shell, runs the ipconfig command, outputs the results to a file, and exits:

Cmd /c "ipconfig > c:\ipconfig.txt"

Creating Command Line Scripts

Command Line Scripts- text files with commands that you want to execute. These are the same commands that you typically enter in the Windows command shell. However, instead of typing commands every time you need them, you can create a script to do so and make your life easier.

Since scripts consist of standard text characters, they can be created and edited in any standard text editor, say Notepad ( notebook). When entering commands, be sure to start each command or group of commands that must be executed together on a new line. This will ensure they are executed correctly. When you've finished creating the command line script, save the script file with a .bat or .cmd extension. Both extensions work the same. For example, if you need to create a script to display the system name, Windows version, and IP configuration, include the following three commands in the SysInfo.bat or SysInfo.cmd file:

Hostname ver ipconfig -all

Controlling the display of text and commands

Team ECHO serves two purposes: to write text to output ( for example, to a command shell window or a text file) and to enable/disable command echo display. Typically, when you run script commands, the commands themselves and the output of those commands are displayed in a console window. This is called command echoing ( command echoing).

To use the ECHO command to display text, type echo followed by the text you want to display:

Echo The system host name Is: hostname

To control echoing of commands using ECHO, type echo off or echo on, for example:

Echo off echo The system host name is: hostname

To direct output to a file rather than to a shell window, use output redirection, for example:

Echo off echo The system host name is: > current.txt hostname » current.txt

Now let's see how command echoing is suppressed. Start a command shell, type echo off, then other commands. You will see that the command prompt is no longer displayed. Instead, only what is typed in the console window and the output of executed commands appears. In scripts, the ECHO OFF command disables command echoing and the command prompt. By adding the ECHO OFF command to your scripts, you prevent your shell window or file from becoming cluttered with command text if you are only interested in the output from those commands.

Studying system information

Often, when working with a user's computer or a remote server, there is a need to obtain basic information about the system, such as the name of the user registered in it, the current system time, or the location of a specific file. Commands that collect basic system information include:

  • NOW- displays the current system date and time in 24-hour format, for example Sal May 9 12:30:45 2003. Available only in Windows Server 2003 Resource Kit;
  • WHOAMI— reports the name of the user currently registered in the system, for example adatum\administrator;
  • WHERE— searches for files using a search pattern ( search pattern) and returns a list of matching results.

To use NOW or WHOAMI, simply type the command in the command shell window and press Enter. The most common syntax for WHERE looks like this:

Where /r base_directory_file_name

Here the /r parameter is specified for a recursive search starting from the specified directory (base_directory) and including all its subdirectories, and file_name is the full or partial name of the file being searched, which may include wildcards: the ? replaces one character, and the * sign replaces a group of characters, for example data???.txt or data*.*. The following example searches the C:\ directory and all its subdirectories for all text files whose names begin with data.

Where /r C:\data*.txt

You can also find files of all types whose names begin with data:

Where /r C:\data*.*

Sometimes you need to obtain information about the system configuration or the system environment. On mission-critical systems, this information can be saved or printed for reference. Listed below are commands that allow you to collect information about the system.

  • DRIVERQUERY— displays a list of all installed device drivers and their properties, including the module name, display name ( display name), driver type and build date ( driver link date). The all information display (/V) mode reports the status and state of the driver, startup mode, memory usage information, and file system path. The /V option also turns on detailed information about all unsigned drivers.
  • SYSTEMINFO- Provides detailed information about the system configuration, including information about the version, type and manufacturer of the operating system, processor, BIOS version, amount of memory, regional standards, time zone, and network adapter configuration.
  • NLSINFO- Displays detailed regional information, including default language ( default language), Windows code page, time and number display formats, time zone, and installed code pages. This command is only available in the Windows Server 2003 Resource Kit.

To use these commands on your local computer, simply type the name of the desired command in the command shell window and press Enter.

Commands for using the registry

The Windows Registry stores configuration information for the operating system, applications, users, and hardware. This data is contained in sections ( keys) and parameters ( values) registry, which are located in a specific root section ( root key), which controls how and when sections and parameters are used.

If you know the paths to the partitions and understand the allowed data types in the partitions, you can use the command REG to view sections and parameters and manipulate them in a variety of ways. REG supports several subcommands:

  • REG add— adds a new subsection or element to the registry;
  • REG delete— deletes a subsection or element from the registry;
  • REG query— displays a list of section elements and subsection names ( if they are);
  • REG compare— compares subsections or registry elements;
  • REG I'm sorry— copies a registry element to the specified partition path on a local or remote system;
  • REG restore— writes previously saved subsections, elements and parameters to the registry;
  • REG save— saves a copy of the specified subkeys, elements and registry settings to a file.

System Services Management

Services provide key functionality for workstations and servers. To control system services on local and remote systems, use the service controller command ( service controller command) S.C., which has a set of subcommands, only part of them is described below:

  • SC config— setting up accounts for registering and running services;
  • SC query— displaying a list of all services configured on the computer;
  • SC qc— displaying the configuration of a specific service;
  • SC start— starting services;
  • SC stop— stopping services;
  • SC pause— suspension of services;
  • SC continue— resumption of services;
  • SC failure— specifying actions to be performed when a service fails;
  • SC qfailure- View actions taken when a service fails.

In all commands you can specify the name of the remote computer whose services you want to work with. To do this, insert the UNC name or IP address of the computer before the subcommand you are using. Here's the syntax:

Sc ServerName Subcommand

Reboot and shutdown systems from the command line

Systems often have to be rebooted or shut down. One way is to use the Shutdown utility for this, which allows you to work with local and remote systems. Another way to control system shutdown or reboot is to assign a shutdown task. Here you can use Schtasks to specify a shutdown time, or create a script with a list of shutdown commands for individual systems.

The following commands allow you to control the reboot and shutdown of the local system.

Shutting down the local system:

Shutdown /s /t Shutdown Delay /1 /f

Shutdown /r /t Shutdown Delay /1 /f

Application, process and performance management

Whenever the operating system or user starts a service, application, or command, Microsoft Windows starts one or more processes to manage the associated program. Several command line utilities will make it easier for you to monitor and manage programs. These utilities include:

  • Pmon (Process Resource Manager) - Shows performance statistics, including memory and CPU usage, and a list of all processes running on the local system. Allows you to receive detailed " pictures» resources involved and processes performed. Pmon comes with the Windows Resource Kit;
  • Tasklist (Task List) - lists all running processes by name and process ID, reports information about the user session and occupied memory;
  • Taskkill (Task Kill) - stops the execution of a process specified by name or identifier. Using filters, you can stop processes depending on their state, session number, CPU time, memory footprint, user name, and other parameters.

That's basically all I wanted to tell you about the basics of the Windows command line.

Description of console commands

Almost all the commands you can run in the command window

Identical to standard MS-DOS commands, but in addition to them there is

Quite an extensive set of native Windows XP console commands. Their short-

Command arguments.

Dir [path] [filename] attributes]]

[I [[:]vrenya]] order]]

Description of console commands 129

Displays the contents of the current folder. If the command argument is

If the drive and path are specified, a listing of the contents will be displayed in the console window

The specified folder. The meanings of the other arguments are:

/A - output only files with the specified attributes:

D - directories only;

O N - only hidden files;

S - system files only;

The hyphen before an argument (≪-≫) has the meaning of the logical operator ≪NOT≫.

For example, the command dir /A:D displays only the list of subfolders of the current folder,

The command dir /A: -S lists all files and folders, excluding system-

/B - output only file names (without extensions);

/C - use of the digit group separator when displaying dimensions

/D - displays a list of files in several columns with sorting;

/L - output file names in lowercase font;

/N - displays file names in the rightmost column;

/0 - sorts the list of displayed files in the following order:

Q N - by name (according to the alphabet);

S - by size (in ascending order);

E - by extension (according to the alphabet);

D - by creation date (from oldest to newest);

G - output first of all the subfolders of the current folder.

A hyphen before an argument (≪ ≫) reverses the order of output. For example

Mer, the command dir /0-S displays the contents of the current folder according to size

Files in descending order.

/P - page-by-page output of a listing of files and folders with a mandatory pause

When the screen fills;

/Q - display information about file owners;

/S - displays a list of files along with a list of the contents of subfolders;

/T - displays a list of files in accordance with the specified time criterion:

From - by date of creation;

W - by date of last change;

A - by the date of the last access to the file;

/W - display a list in several columns;

/X - display short names for files whose names do not match

DOS standard. The format is similar to the output with the /N switch, but short names

130 Chapter 7. Command Line

Files are displayed to the left of the long ones. If the file does not have a short name,

Spaces are printed instead;

/4 - output the year number in four-digit format.

Cd [drive:] [path:]

Chdir [drive:] [path:]

Go to the specified folder, where the drive and path are full or relative path

To this folder in the file structure of your disk. Instead of an argument maybe

The value ≪..≫ is used, indicating a transition one level up

(in this case the command will look like this: cd..). If in the path designation

There is a space character; such a path can be enclosed in quotes.

The /D argument is used to change the current drive and folder at the same time.

For the CHDIR command, the name of the current directory in the call line is converted to volume

The same character case in which the names existing on the disk are typed. So,

The command cd C:\TMP will actually make the current directory C:\Trnp if it exists.

Available on disk. The CHDIR command no longer treats spaces as separators.

Whether, which allows you to move to a subdirectory whose name contains spaces, is not

Enclose the entire name or path in quotes. For example, the command cd \winnt\profiles\

Username\programs\start menu produces the same result as the cd command

"\winnt\profiles\username\programs\start menu".

If you need to go to the root folder of a drive, you can simply type

On the command line, the name of this drive. For example, command E: goes to the root

Drive partition E:.

COPY [from] that [+ source [+ . . . ] ] [where [under name] ]

Copying one (or more) files to another location on the disk. Here:

[from] what - path and name of the source file to copy. If the path is from

Yes, the copied file will be taken from the current folder;

Where [under name] - path to the folder to which this file should be copied

The file, as well as its name, if this name is determined during the copying process

/A - indicates that the file is an ASCII text file;

/B - indicates that the file is a binary file;

/D - indicates the possibility of creating an encrypted file;

/V - check whether files are copied correctly;

/N - whenever possible, use short names when copying;

Description of console commands 131

/Y - do not request confirmation to overwrite the file if the target

/-Y - be sure to request confirmation to overwrite the file if

A file with the same name already exists in the target folder;

II- copying network files.

To combine multiple files when copying, specify one final

And multiple source files using wildcards or format

File1+file2+file3+

Example of using the command:

Copy c:\programs\filel.exe /V d:\files\file2.com - copies the file filel.exe, located

Placed in the programs folder on the C: drive, in the files folder on the D: drive under the name

MKDIR [drive:]path

MD [drive:]path

Creates a folder in the specified folder or on the specified drive. In case of using

Niya extended command processing command MKDIR can be used

With additional options to automatically create all

Intermediate folders in the specified path. For example, if the /a folder does not exist -

No, then the mkdir \a\b\c\d command performs the same actions as the sequential

Number of teams

MOVE [drive:][path]filename [ , . . . ] appointment

MOVE [drive:][path]foldername newfoldername

The command moves the specified file or folder to a new location on

Disk. Here:

[drive:][path]filename - full or relative path and name of the file being moved

My file or group of files. The list of files can be specified and transferred

By counting file names separated by commas, and using sub-symbols

Stations;

Destination - the path to the folder where the specified file should be moved.

If you want the file to be renamed at the same time as moving

Wang, along with the destination path, you can specify its new name;

Folder_name - the name of the folder you want to move;

New_folder_name - the name that should be assigned to the folder when moving it,

If you want to rename it at the same time as moving it;

132 Chapter 7. Command Line

/Y - display a warning window when overwriting files and folders,

If file objects with the same name already exist in the destination folder;

/-Y - overwrite files and folders without warning if the folder contains

Values ​​There are already file objects with the same name.

RMDIR [drive:]path

RD [drive:]path

The command deletes the folder with the specified name. Here:

[drive:]path - full (or relative) path to the folder to be deleted. If

The path is not specified, but only the folder name is given as the command argument,

This folder will be removed from the current folder;

/S - delete not only the specified folder, but also everything contained in it

Subfolders and files;

/Q - do not display a request for confirmation of deletion if the folder being deleted

Contains other file objects.

REPLACE [drive1:][path1]filename [drive2:][path2]

REPLACE [drive1:][path1]filename [drive2:][path2]

Using this command, you can replace those located in any folder with

The files on your computer's disk are a different set of files. Here:

[drive1:][path1]filename - the path and name of one or more files that

You should replace the files in the specified folder;

[drive2:][path2] - path to the folder in which the replacement is carried out;

/A - the specified files are added to the target folder without destroying its contents

Tabernacle Contents (this key is incompatible with the /S and /U keys);

/P - display a prompt on the screen before overwriting or copying

/R - allow overwriting and replacement of files with the ≪Read-Only attribute

Niya≫ along with others;

/W - when copying files from a floppy disk, wait for the disk to be inserted until

Start of operation;

/S - replace files while maintaining the folder structure, that is, in

All subfolders of the target folder along with all their contents;

/U - replace only those files whose moved copies have more

New version.

RENAME [drive:][path]filename1 filename2

REN [drive:][path]filename1 filename2

Renames one or more files in the specified folder

(in this case, the file filename1 is renamed to filename2).

Description of console commands 133

Please remember that you cannot specify a different drive or

I'm missing a folder.

DEL attributes]] argument

ERASE attributes]] argument

Deleting the files specified in the command. Used as an argument

Names of one or more files, and to delete a group of files

Wildcards can be used. If the argument is given

Folder, all files will be deleted from it. Here:

/P - display a confirmation request before deleting each file;

/F - forcefully delete files accessible only to

/S - deletes the files specified in the argument from all subfolders of the specified

/Q - disables the display of a request to confirm the deletion of each file;

/A - delete only files with the specified attributes:

N - only hidden files;

Q S - system files only;

R - read-only files;

A - only files with the “Archive” attribute.

The hyphen (≪-≫) before an argument has the meaning of a logical operator

≪NOT≫. For example, the ERASE d:\folder\*.dll /A: -S command will allow you to remove

Placed on drive D: folder FOLDER all files with the extension .DLL, with the exception of

Reading system ones.

NOTE

The output results for the /S switch are reversed, that is, in the console window

Only the names of deleted files are displayed, not files that could not be found.

REM [text]

Places the specified comment in a batch file or CONFIG.SYS file.

ASSOC [.extension[=[file type]]]

Allows you to set file associations for various file types. Here:

Extension - extension of the files for which the association is being established;

File type - the program that should be associated with this file type.

If this command is issued without using additional arguments,

The screen displays the current table of file associations for all associated

Bathrooms in the file system. If you specify only the extension registered

For each file type, a list of associations for that file will be displayed on the screen.

134 Chapter 7. Command Line

Extensions. If there is no matching specified after the equals sign for a given

file type, all existing associations for such files will be removed.

AT [\\computer_name] [ [number] | /DELETE ]

AT [\\computer_name] time [ /EVERY:day[,...] | /NEXT:fleHb[,...]]

"team"

This command is intended to launch various programs or perform

Commands are run on a schedule - at a given time on certain days. Use

Calling the AT command is only possible if your computer

The task scheduler has started. Here:

\\computer_name - the name of the remote computer on the local network using

This occurs if the program is launched from this machine. If this couple-

The meter is omitted, the job is assigned to the local computer;

Number - serial number of the scheduled task;

/delete - cancel a previously scheduled task. If the task code is not specified,

All tasks scheduled for this computer are canceled;

/yes - do not display a request to confirm the deletion of all scheduled

New tasks;

Time - the time the command was launched in the format HH:MM:SS;

/interactive - allow task interaction with the user, work-

Users on the computer while the task is running;

/euegu:day[,...] - the task is launched on the specified days of the week or month-

Tsa. If date is omitted, the current day of the month is used;

/next: day[,...] - the task will be launched on the next user specified

Lem day of the week (for example, next Tuesday). If the date is omitted, use

Uses the current day of the month;

"command" is a Windows XP console command or the name of a batch file.

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -N] [drive:] [path] [filename] ]

Sets the specified attributes for the given file:

Set the specified attribute;

Remove the specified attribute;

R - “Read Only” attribute;

A - “Archive” attribute;

S - “System” attribute;

H - “Hidden” attribute;

[drive:] [path] [filename] - drive, path and name of the file or set of files for

Team processing;

/S - process files with the specified names not only in the current folder,

But also in all its subfolders;

/D - processing of both files and folders.

Description of console commands 135

This directive enables or disables process interrupt handling mode

Execution of the program in the DOS environment by pressing the Ctrl+C keys. On Windows XP

This command has been included for software compatibility purposes only.

By the grams of MS-DOS, it does not affect the operation of Windows applications. When turned on

Changes to advanced command processing in the Windows XP operating system

The BREAK command causes a breakpoint state while the program is running.

Go Windows Debugger.

CACLS filename ] ]

[L)name [ . . . ] ]

Manage file access lists (ACLs), including viewing and editing them.

Tiling. Applies only to disk partitions containing file

NTFS system. Here:

Filename - if there are no other arguments, displays a table

Access control for this file;

/T - replacement of access control tables for a given file or group of files

Fishing both in the current folder and in all subfolders of this folder;

/E - change (edit) the access control table for this

Go file or group of files;

/C - continue executing the command when receiving a denial error

/G name-.access - assigns access permissions to the specified file objects

There for the user whose account is specified as argument

Name. Among the possible types of access that should be entered as an ar-

Gumenta access, the following can be listed:

R - read-only access;

W - write access;

F - full access;

/R name - revoke all permissions for the user whose account

The name is specified as an argument. Used only with the /E switch;

/P name:access - replacing existing permissions for the user, account

An entry whose name is specified as an argument, with permissions specified

As an access argument:

N - no permissions;

O R - read-only access;

W - write access;

C - edit access (includes the action of argument W);

F - full access;

136 Chapter 7. Command Line

/D name - deny access to a file or folder for the user account

The letter of which is specified as the name argument.

NOTE

To assign access modes for a group of files, you can use

Filename values ​​are wildcards. Also, when calling a command, you can specify

Add multiple users.

In the process of displaying access control tables of the operating system,

My following conventions are used:

CI (Container Inherit) is a sign of inheritance of permissions by containers.

ACE will be inherited by folders;

01 (Object Inherit) - a sign of inheritance of permissions by objects. ACE bu-

Det inherited files;

Yu (Inherit Only) - a sign of exclusive inheritance of permissions.

ACE cannot be applied to the current file/folder.

Example of using the command: CACLS private.txt /G user:F - opens for

USER has full access to the private.txt file.

CALL [drive:][path]filename [options]

This command allows you to call one batch file from another. As

The parameters argument uses a set of command line switches required

Myh when calling the target batch file. The CALL command can also be used

Used in conjunction with special marks that play in this case

The role of the destination (point) of the batch file call. In this case, the following applies:

Blowing syntax:

CALL: label arguments

When using this option for calling this command, the operating system

MA automatically creates a new context for the current batch file with the specified

Arguments, and control of file execution is transferred to the instruction, following

Blowing directly after the mark. The batch file is exited

By reaching its end twice: the first output transfers control to the

The line immediately following the line containing the CALL directive, second output

Terminates file execution. Using the GOTO:EOF instruction allows you to implement

Unconditionally interrupt the execution of a file at any point.

SNSR

Sets the active code page with the specified number.

When called without arguments, returns the current code page number.

CHKDSK [volume:[[path]filename]] ]

Checks the specified disk using the Check Disk program, when called without

The arguments are checked for the current drive. Here:

Description of console commands 137

Path, file name - the name of the file or group of files to check for fragment -

Qiyu. Used only in the FAT/FAT 32 file system;

/F - checking for errors and automatically correcting them;

/V - during the disk check process, display the full paths and names of stored

On disk files. For disks containing NTFS partitions, the

Cleanup messages;

/R - search for damaged sectors and restore their contents

My. Requires the mandatory use of the /F switch;

The switches all current descriptors for this volume will be invalid -

Ny. Requires the mandatory use of the /F switch;

/L: size - during the scan, change the size of the log file to the specified size

Values ​​(in kilobytes). If no value is specified, the current one is displayed

File size. Used only in the NTFS file system;

/I - do not perform strict checking of index elements. Used only

Co in the NTFS file system;

/C - do not check loops within the folder structure. Used only in files

Logical NTFS system.

NOTE

The /I and /C switches significantly reduce the operating time of the Check Disk program, but less

Strictly checking a disk may result in skipping some of its files.

Low error system.

CHKNTFS volume: [ . . . ]

^CHKNTFS/D

CHKNTFS /T[:time]

CHKNTFS /X volume: [ . . . ]

CHKNTFS /Volume: [ . . . ]

Controls the operating modes of the Check NTFS program when the computer boots

In case of checking for errors. Here:

Volume - defines the volume label of the disk being checked, the connection point, or

Drive name with colon (for example, C:);

/D - turns on the standard disk scanning mode of this program:

The disks are checked every time you boot the computer, if

If errors occur, CHKDSK is run;

/T[: time] - allows you to change the value of the AUTOCHK parameter (in seconds),

Controlling the period of time before the start of automatic testing

Ki disks (during this time the program conducts a second-by-second reverse

Countdown). If the time period is not specified, the current

AUTOCHK parameter value;

138 Chapter 7. Command Line

/X - prohibits standard disk checking during boot.

Data on disks previously excluded from the check list is lost.

/C - requests permission to check disks at next boot

Computer. If errors are detected, the CHKDSK program is launched.

When you call this command without any arguments, the screen displays

The current state of the check flag for this disk.

Its execution clears the command line screen.

Starts another copy of the Windows XP command interpreter (see section

COLOR [color]

Sets the default background and text color options for

Command line text windows. Color values ​​are set using

The number of two hexadecimal numbers, the first of which specifies the background color of the window,

And the second is the color of the text. As each of these numbers, this command can

The following values ​​can be used:

0 - black;

1 - blue;

2 - green;

3 - blue;

4 - red;

5 - purple;

B - yellow;

7 - white;

8 - gray;

9 - light blue;

A - light green;

B - light blue;

C - light red;

D - light purple;

E - light yellow;

F - bright white.

For example, when you call the COLOR OB command, the background of the command line window will remain

Black, and the font will turn light blue. When performing this co-

Mandas without any arguments will automatically restore the colors

Command prompt windows specified in the DefaultCoior key of the Windows XP registry.

Description of console commands 139

The COLOR command returns an error with code ERRORLEVEL 1 if the user

Tel will try to set the command argument to the same colors

For background and text.

COMP [filename1] [filename2]

Using this command, you can compare the contents of two files or two

Filesets if the arguments filename1 and filename2 are specified using

I eat wildcards. Here:

File_name1, file_name2 - names of files or sets of files for comparison;

/D - display information about detected differences in decimal

Format;

/A - display information about detected differences in ASCII format;

/L - display line numbers where differences are found;

/N=4HOIO - the number of first lines in each file that should be compared

/C - cancel case sensitivity: comparison will be made without taking into account

ASCII character register;

/OFF - check also in files with the checkbox selected

“Autonomous”.

COMPACT ] [ / I ] [filename [ . . . ] ]

Displays and also allows you to change the compression ratio of files stored

On disk partitions with the NTFS file system. Here:

/C - compress the files and folders listed as the file_name argument. Folders

They are marked in such a way that files subsequently added to them

Also become compressed;

/U - unpack the files and folders listed as the file_name argument

Ki. Folders are marked in such a way that those added to them later

The files become uncompressed;

/S - process all subfolders and files stored in them. By

By default, the command processes only the current folder and its contents;

/A - process files with the “Hidden” and “System” attributes. By default

Chaniya skips such files;

/I - force the command to continue execution even if an error occurs.

Nii errors. By default, when an error occurs, all errors caused by this

The command stops operations;

/F - force compression of all user-specified files, even if

Some of them are already compressed. In default mode, compressed file files

Objects are not processed;

/Q - display only the most important ones on the screen during the operation

Intelligence.

140 Chapter 7. Command Line

When you call the COMPACT command without any arguments in the Command Prompt window,

Key displays compression information for files stored in the current folder. At

When listing several parameters on the command line, they should be

Separated by spaces.

CONVERT drive: /FS:NTFS

Converts FAT disk partitions to NTFS format. The command is not executed

For the current disk partition. Here:

Disk: - name of the disk partition to be converted, followed by a colon, for example F:;

/FS:NTFS - target file system (NTFS);

/V - display system messages during the operation;

/Sut,Agea:file_name - the name of the service file in the root partition of the disk for re-

Reserving disk space for NTFS system files;

/NoSecurity - disable restrictions on access to converted files

And folders;

/X - if necessary, dismount the volume before scanning it. After from-

Switches all current descriptors for this volume will be invalid.

DATE [ I ][date of]

Dates according to the computer calendar and prompts you to enter a new date. To save

To enter the current date, press the Enter key. With the key /T command pro-

One hundred displays the current date without asking you to change it.

DISKCOMP [disk1: [disk2:]]

This command performs a file-by-file comparison of two floppy disks.

DISKCOPY [disk1: [disk2:]]

This command copies the contents of one floppy disk to

Another. In this case, the copied disks must have the same disk space

th space and the same file system, and the command arguments can

Refer to the same physical device - for example, drive A:.

When using the /V key, copying is performed while checking the correct

Nosti records.

ECHO ON or OFF

ECHO [string]

The command repeats on the screen messages entered by the user as

The string parameter also allows you to configure the message display mode in the window

Description of console commands 141

Command line. When calling a command without arguments, the screen returns

Current mode value.

This command is used without any additional parameters. At

When executed, the command interpreter program exits and

Closing the command line window.

FC] [I]

[drive1:][path1]filename1 [drive2:][path2]filename2

FC /In [drive1:][path1]filename1 [drive2:][path2]filename2

This command compares two files or sets of files (if

Arguments are specified using wildcard characters) and displays information

Maziu about the differences between them. Here:

[drive1:][path1]filename1, [drive2:][path2]filename2 - paths and names of the first

And the second files (sets of files) intended for comparison;

/A - display only the first and last lines for each group of times -

/B - compare binary files;

/C - compare case-insensitive;

/L - compare files in ASCII format;

/LBn - detect the maximum number of inconsistencies for the number of rows,

Specified by parameter n;

/N - display line numbers on the screen when comparing files in the format

/OFF - compare files with the “Offline” checkbox selected;

I - do not treat tab characters as equivalent when checking

Number of spaces;

/U - compare files in Unicode format;

/W - skip spaces and tab characters during scanning;

/nnnn - this parameter specifies the number of consecutive matching lines

Which should be met after identifying a non-conformity.

FIND L7N] ] "string" [[drive:][path]filename[ ...]]

Searches for a specified string in a file or set of files. Here:

[drive1:][path1]filename - full or short path and name of the file in which

A search is in progress;

New sample;

/C - display only the total number of lines containing the specified pattern;

142 Chapter 7. Command Line

/N - display only line numbers containing the specified pattern;

/I - do not distinguish between upper and lower case characters during the search process;

Nominal≫.

If you enter this command without any arguments, the search is performed

In the text entered from the keyboard, or in the text transmitted through the conveyor

Manage FIND with another console command.

FINDSTR [D.]

] lines

[[drive:][path]filename]

This directive searches for files containing the specified pattern. Here:

[drive:][path]filename - full or short path and file name (group

Files) among which the search is carried out;

Line - a line with a sample text to be searched;

/B - search for a given pattern only at the beginning of lines;

/E - search for a given pattern only at the end of lines;

/L - search for a complete match of a given pattern to the text in the file;

/R - search for strings only as regular expressions;

/S - search for files containing a given sample in the current

The folder and all its subfolders;

/I - search case insensitive;

/X - display lines containing exact matches to the specified

Sample;

/V - display as a search result all lines that do not contain the specified

New sample;

/N - display the numbers and contents of lines containing the specified pattern;

/M - display only the name of the file that matches the image

/0 - display found lines using interlaced interlacing

/P - ignore lines containing non-printable characters;

/OFF - search in files with the “Auto” checkbox selected

Nominal≫;

/A:colors - sets the color values ​​that will be used to display

Read the search result (see the section describing the COLOR command);

/P:file - get a list of files viewed during the search from

Text file;

/C: string - use the specified string as a search phrase;

/ygfile - get a list of lines with search patterns from a given file;

Description of console commands 143

/D:cnMCOK_nanoK - get a list of parameters viewed during the search process

Poke from a text file (folders in the list are separated by semicolons).

The FINDSTR command can also use the following series in the contextual search string:

Special regular expressions, a quick reference to the syntax of which

Substitute any symbol instead of the dot sign;

L - look for an entry at the beginning of the line;

$ - search for an occurrence at the end of the string

[x-y] - range of possible values: search for any characters from the specified

Range;

\

Xyz\> - search for an occurrence at the end of a word.

FORMAT disk:

FORMAT disk:

FORMAT disk:

FORMAT disk:

FORMAT disk

Formats the specified disk with the specified parameters. Here:

Disk: - name of the disk partition to be formatted with a colon, for example F:;

/FS: system - specifies the file system type for the formatted disk (FAT,

FAT 32 or NTFS);

/V: label - indicates the volume label that will be written to the disk upon request.

Completing the formatting process;

/Q - perform quick formatting of the specified disk;

/C - sets the compression mode of file objects for the formatted

Partition (used only in NTFS);

/X - if necessary, disable the volume before forming it

Tiling. After unmounting, all current handles for that volume

Will be invalid;

/F:size - an explicit indication of the formatted floppy disk standard (1.44);

/T: tracks - the number of tracks on each side of the disk;

/N: sectors - number of sectors on each track;

/A:size - an explicit indication of the size of the clusters created during formatting

Rotation of this section. Please remember that the NTFS file system is

Supports cluster sizes of 512, 1024, 2048, 4096, 8192 bytes, as well as 16, 32,

64 KB. The FAT system (FAT 16) supports cluster sizes of 512, 1024,

2048, 4096, 8192 bytes, 16, 32, 64 KB, and 128 and 256 KB for size

Sectors larger than 512 bytes. FAT 32 file allocation table supports

Cluster sizes 512, 1024, 2048, 4096, 8192 bytes, 16, 32, 64 KB, as well as

128 and 256 KB for sector sizes greater than 512 bytes. In addition, file

144 Chapter 7. Command Line

The FAT 16 and FAT 32 systems impose the following restrictions on the number of

Steers in one volume: for FAT, the number of clusters must be less than or equal to

65526, for FAT 32 this value should be in the range between

65,526 and 4,177,918 clusters. The FORMAT command will execute immediately

Aborted if a violation of the established restrictions on use is detected.

Use the specified cluster size.

NOTE

When formatting NTFS partitions with data compression mode set, it is necessary to

Please note that compression of NTFS volumes is not supported if

The clusters in the volume exceed 4096 bytes.

ATTENTION

Please remember that when you format a disk, all data stored on it will be

Irretrievably lost.

FTYPE [file_type[=[command line]]]

Matching any file type registered in the system to

The command line used to open it. As arguments for this

The following commands can be used:

Rogo plans to change the opening command line;

Command_line - the very value of the command used to open the file

Fishing of this type.

When you call the FTYPE command without any additional parameters, it will

Maintains a list of all command prompts installed in Windows to open and

Associated files. When specified as a command argument

Only the name of a file will display the command in the command line window

Call this file if it was previously set in the system. If after the sign ra-

If you don't specify the command line to install, FTYPE will remove for

The selected file contains all pre-existing mappings.

^GRAFTABL/STATUS

The command specifies the code page number for displaying national characters.

National alphabets in graphic mode. The nnn argument specifies the co-number

The homepage that should be used to display national symbols

Volov by default, calling the command with the /STATUS parameter returns to the screen

Current code page.

This command is used without any additional parameters. At

When executed, a hint on how to use the console commands is displayed on the screen.

Whether Windows XP.

Description of console commands 145

LABEL [drive:][label]

LABEL [volume] [label]

This command allows you to create, change, or delete volume labels for physical

Czech disks and logical disk partitions. Here:

Disk: - name of a disk or disk partition with a colon, for example F:;

Label - the label that should be set for this disk (partition);

Volume - the name of a disk or disk partition with a colon, for example F:, or

Ka of an existing volume. If a volume label is specified, use the /MP flag

Not necessary.

< [диск:][путь]имя_файла имя_команды

MORE [+n]]

MORE /E [+n] [files]

Using this command, you can sequentially display the contents of

My text file or listing for executing a console command. Here:

[drive:][path]filename - full (or relative) path and file name, co-

The contents of which should be displayed on the screen in fragments. If the call-

There are several files, their names should be listed separated by a space;

Command_name - the command whose progress should be displayed

View the screen in fragments;

/E - enable additional functions of the MORE command;

/C - clear the screen before displaying each page;

/P - take into account page scroll symbols;

/S - display a sequence of several empty lines as one

/Тп - replace tab characters n with spaces (default n = 8).

The MORE command supports an additional +n switch that can be used

Call when she is called. It indicates that the first file in the sequence

It should be printed starting from line p.

If you have enabled Advanced Features mode by

Calling the MORE command with the /E parameter in response to the environment prompt - More - -

You can issue special commands to the program by pressing the following keys:

R p - display the next n lines;

S n - skip the next n lines when outputting;

F - go to the output of the next file;

Q - terminate the command;

Display the current line number;

Display tooltip;

Space - go to the next page;

Enter - go to the next line.

146 Chapter 7. Command Line

PATH [[drive:]path[:...][;*PATH*]

Using this command, the user can specify the search path for executable

Files. When you call the PATH command without parameters, the command line window displays

The current search path is compressed. In case of using the YARATCH system variable

The new search string value is appended to the end of the old one. If this command is called

With the "semicolon" parameter, the current search path value will be cleared

But further search for executable files will be limited to the current folder.

PUSHD [path]

When this command is called, the system remembers the user-entered value.

Reading the path to a folder and then going to it, making this folder the

Tabernacles. If advanced processing mode is enabled in the command prompt window

Commands, as an argument to the PUSHD command, you can use not only local

Kalnye, but also network paths. In this case, the system independently finds the given

New network resource, connects it as a network drive, and then moves

Dits on him. Network drive names are assigned automatically by searching through all

Free names, starting with Z:, in reverse order, with the connected se-

The resource will be assigned the first free name found by the system.

This command is used without any additional parameters. At

Its execution performs a quick transition to the folder specified earlier when

The power of the PUSHD team. If extended mode is enabled in the command prompt window,

No command processing, when calling the POPD command, all temporary

Network drive names created by the PUSHD command while simultaneously deleting

The corresponding network drive from the folder stack.

PRINT [[drive:][path]filename]

When this command is called, the specified on the command line is printed.

The file whose path is written as the [drive:][path]filename argument. By-

Using the /O:device Key you can specify a device (for example, a

Tera) on which to print.

PROMPT value

By default, the command prompt window displays the operating prompt.

Systems in the standard MS-DOS format, which looks like drive:\path>, for example

The PROMPT command allows you to change the appearance of the operating system prompt.

For these purposes, you can use a set of special variables:

$A - & (ampersand);

$B - | (vertical bar);

Description of console commands 147

$C - ((left parenthesis);

$D - current date;

$E - ESC (ASCII character code 27);

$F -) (right parenthesis);

$G - > (greater than sign);

$Н - Backspace (removing the previous character);

$L -< (знак ≪меньше≫);

$N - name of the current disk;

$P - names of the current disk and directory;

$Q - = (equal sign);

$S - space;

$T - current time;

$V - Windows XP version number;

$_ - carriage return and line feed;

$$ - $ (dollar symbol).

In addition to the listed variables and their combinations as an argument,

PROMPT mands can use an arbitrary sequence of characters.

For example, after executing the command

PROMPT welcome: $a root $S$C$D$F$$

The operating system prompt will look like this:

welcome:& root(17.04.2002)$

And after executing the PROMPT directive, enter the command: $_ prompt operating

Noah system will be displayed as follows:

Enter the command:

RECOVER [drive:][path]filename

Using the RECOVER command, you can restore the saved damaged

Data disk information. As arguments [drive:][path]filename uka-

Enter the drive, path and name of the file to be restored. For example, if you

Use the RECOVER A:\file.txt command.

START ["header"] [A)path] [/I]

[command/program] [options]

This command allows you to run any program with a specified

New initial parameters. Here:

Title - the title of the program, which will be displayed in the title line.

Trap the window opened for this program;

148 Chapter 7. Command Line

/Dnyrb- indication of the working folder of the program being launched, in which the

All the files necessary to download it are included;

II - launching the program not in the new environment, but in the original environment, re-

Edited by the CMD command interpreter;

/B - setting the mode of interrupting program execution by pressing the combination

Keyboard dance Ctrl+C. If this application does not handle key presses,

Vish Ctrl+C you can pause its execution by pressing keys Qrl+Break;

/MIN - launch the program in a window minimized to the Taskbar;

/MAX- launch the program in a window maximized to full screen;

/SEPARATE - launch a 16-bit Windows application in a separate area

Ti memory;

/SHARED - launch a 16-bit Windows application in a shared area of ​​the pa-

/LOW - launch the application with low execution priority (IDLE);

/NORMAL - run the application with normal execution priority

/HIGH - launch the application with high execution priority (HIGH);

/REALTIME - launch the application with real-time priority using

Fullness (REALTIME);

/ABOVENORMAL - launch the application with a higher execution priority

Average (ABOVENORMAL);

/BELOWNORMAL - launch the application with a lower execution priority

Average (BELOWNORMAL);

/WAIT - start the application while waiting for it to complete;

Command/program - path and name of the command or program itself. If at

The power of the START command runs an internal CMD shell command or

Batch file, a new CMD window will be launched with the /K key, other words

By you, it will not be closed at the end of the program session. If

You are launching some other application, the system will be open for it.

Dart graphics window Windows XP;

Parameters - external parameters, keys and variables passed to the pro-

Gram by the CMD environment when it is launched.

NOTE

To call executable files by opening their associated types

Files from the command console window just need to type the full name at the command line

Such a file. For example, when calling document.doc from a command line window, the associated

When placed on a system running Microsoft Word, Windows will automatically launch Word

For execution and load this file into it.

When running a 32-bit GUI application from the

The command line command handler does not wait for the application to terminate

Before closing his window And back to invitation operating system.

Description of console commands 149

This principle applies to all cases of launching programs, except for their initialization.

Call from batch files.

If the file extension is not specified on the command line, the handler

The command uses the value of the RATNEXT environment variable in order to determine

List executable file name extensions and program search order in

Disk file structure. By default, this variable is assigned the values

Niya.COM;, .EXE;, .BAT;, .CMD. Syntax for writing values ​​for a given variable

The syntax is similar to the PATH variable, that is, individual section elements

They are marked with a semicolon.

If during the search for an executable file no matches were found

With one of the extensions registered in the system, the program checks

Matches the specified folder name. If the folder name matches the specified

Mu, then the START command launches Explorer, which opens this folder for review.

SUBST [drive: [drive2:]path]

SUBST drive: /D

This command allows you to match a user-specified pathname to the name of any

Disk. This command can be used to create virtual

Disks in any folder in the file structure of your computer or for mon-

Tire the disk at any point you choose. Here:

Disk - names of virtual disks that map to the specified location.

Disk2:path is the physical disk for which the mapping is being created;

/D - key that deletes a previously created virtual disk.

TIME [time] [I]

Without additional arguments, this command prints the current value

Time according to the computer clock and prompts you to enter a new time value. For

To save the current time, you must press the Enter key. With /T key

The command simply displays the current time without prompting you to change it.

TITLE [string]

Outputs the given string as the value of the command window's title bar -

Noah lines. Any command can be specified as an argument.

Consequence of symbols.

TREE [drive:][path]

Displays the folder tree or layout structure in the command prompt window

Files and folders in a specified folder on disk. Here:

In the form of a directory tree;

150 Chapter 7. Command Line

/A - substitute ASCII characters instead of characters from national alphabets

When displaying files whose names are specified in national encoding;

/F - display file names for each folder.

When calling a command without additional parameters, the CMD window displays -

This is the tree of the current folder.

TYPE [drive:][path]filename

This command displays the contents of the specified file.

This command is used without any additional parameters. At

When executed, the current version number of Windows XP is displayed on the screen.

VERIFY

Enables or disables additional check mode when writing data

To disk. Use this command without additional parameters to define

Recording the current state of the record check function.

VOL [disc:]

Displays the label value of the specified drive. Without additional parameters

The manda returns the label of the current disk.

XCOPY source [result] [I>[:date]] ]

^ C/Q] [I]

[+fileZ]]

Using this command you can copy large groups of files or

Entire folder structures along with their contents. Unlike similar co-

Mand, XCOPY has greater capabilities and allows you to use

Choose from many different parameters:

Source - a file, group of files or folders intended for copying;

Result - path to location and/or names of new files and folders

When they are renamed at the same time;

/A - copying (among others) files with the “Archive” attribute; at-

A rebut does not change its meaning when copied;

/M - copying only files with the “Archive” attribute; upon completion

The copy attribute is removed;

L)[:date] - copy only files modified after the specified date.

If no date is specified, only files earlier than versions are copied.

Files stored in the target folder;

/P - display requests on the screen to confirm the recording of each new

Description of console commands 151

/EXCLUDE:file1[+file2][+file3] - list of files containing contextual

Occurrences of exception lines when copying files. When any of

String matches any part of the absolute path to the copied file, so

Which file is excluded from the copy operation. For example, by specifying the line

\exe\ or .exe, you can exclude all files from the exe folder or all files

With the .exe extension accordingly;

/S - copy directories along with all subdirectories, excluding empty ones;

/E - copy directories along with all subdirectories, including empty ones;

/V - during the copying process, compare the target files with the source ones;

/W - wait for a key press on the keyboard before starting copying

Computer;

/C - continue copying even if errors are detected;

/I - if when copying several files as a parameter the result is

If the name of a non-existent folder is specified, create a new folder with the specified

/Q - do not display the names of copied files;

/F - during the copying process, display the full names of the source files on the screen

And final files;

/L - during the copying process, display full names on the screen only when used

Running files;

/G - if the target directory does not support encryption, copy

Place encrypted files into it (for NTFS partitions);

/N - among others, copy hidden and system files;

/R - when copying, completely replace files with the attribute ≪Only for

Readings≫;

/T - without copying files, create a folder structure in the specified location on the disk,

Similar to the original one;

/U - copy and overwrite only existing files

In the target folder;

/K - when copying files with the “Read Only” attribute, save

This attribute (by default it is automatically reset during

Copy);

/N -replace long names with short stanza names when copying

Dartha DOS;

/0 - copy information about its owner and ACL information along with the file;

/X - copy file audit data (requires mandatory use)

Nya key /0);

/Y - ask for confirmation to overwrite the file if in the target folder

A file with the same name already exists;

/-Y - do not request confirmation to overwrite the file if the target

A file with the same name already exists in the folder;

/Z - copy files from a source located on the local network.

152 Chapter 7. Command Line

To get a hint about the rules for using any Windows XP console command

Use command call with key ^II as follows: command_name II, For example

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.

The Command Line Options Reference is an electronic manual in .chm format that teaches how to use the command line. Using the Reference, you can learn how to configure the command line, the operation of Windows services, manage local and remote systems, obtain information about the command shell and processes, and also learn how to automate management tasks using batch files and scripts (CScript and WMIC) command line.

The manual contains an impressive layer of knowledge, thanks to which you can become more familiar with the system command shell - an important software product that provides communication between the user and the operating system. Knowledge of command line options is necessary to work effectively with Windows. The command line is an environment in which utilities and text-based applications are executed. Commands are entered through the cmd.exe interpreter. With its help, applications are loaded, data is exchanged between applications, and entered commands are translated into the form required by the system.

The Command Line Options Reference contains detailed information about Windows operating system management tools using the command line. The manual provides a complete list of required commands with simple and clear explanations, with a detailed description of the syntax, individual parameters and features. The directory interface is as simple and convenient as possible. To find the necessary information on a particular command, just select the initial letter of the service or command in the alphabetical menu on the left side of the window, and then select it from the drop-down list, or you can enter the name of the desired command in the index (through a filter), and the program will automatically display all available information.