Efficient console. SETLOCAL command - changing environment variables for the current batch file

Location: Windows\system32

Description: Windows Command Processor

Windows XP has a so-called console - a program cmd.exe, which is the command interpreter. When launched simply, without specifying command line parameters, the console displays the version of the operating system, information about the copyright protection of OS developers and the command line itself, in which you can enter as a command line parameter the program itself cmd.exe, as well as any external command, for example, a command to launch another application or a standard command such as mkdir, del, etc.

Command Line Options

Command line syntax:

CMD[ team]

You can use several commands at the same time using a special delimiter between them - && characters, and the entire combination of several commands must be enclosed in quotation marks, for example, " team&&team&& team".

/? - call for help

/A- output the results of executing a given command in ANSI format

/C- execution of a given command and then closing the console window

/D- disable the execution of AutoRun commands (which are the first to be automatically executed when cmd.exe is called) specified in special registry sections HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun And HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

/E:ON (/E:OFF)- permission (prohibition) of command extensions. In Windows XP, enhanced processing of all cmd.exe commands is enabled by default; this setting is used to enable/disable extensions for a specific process. Advanced processing includes the following commands: assoc, call, chdir (cd), color, del (erase), endlocal, for, ftype, goto, if, mkdir (md), popd, prompt, pushd, set, setlocal, shift, start(calling external commands has also been changed)

/F:ON (/F:OFF)- allowing (denying) the completion of file and folder names (disabled by default) for a specific cmd.exe call. A rather convenient function that allows you not to completely manually enter file paths or folder names in the console window, but enter only part of a long path and, by pressing a special key combination, let the operating system find suitable options and simply select the one you need. (If you need to enable or disable name completion for all calls to cmd.exe, then see Automatic commands).

User settings take precedence over computer settings, and the value of the /F shell parameter takes precedence over registry settings. Microsoft provides some clarification regarding the use of this feature: "If completion is enabled using the command line switch / F:ON, then two control characters are used: Ctrl+D for folder names and Ctrl+F for file names.

To disable a specific terminator in the system registry, the hexadecimal value of the space character (0 x 20) is used as the special character code. Completion is called when one of these two special characters is entered. The completion function takes the path string to the left of the input point, appends a wildcard character to it if it doesn't have one, and then builds a list of paths that match the resulting definition.

The first element of this list of matching paths is then printed. If the list is empty, a beep sounds and nothing is displayed. After this, entering the same special character again will cycle through all matching paths.

Pressing the Shift key while typing a control character allows you to view the list of paths in reverse order. If you change the output path and then enter the control character again, the saved list is cleared and a new list of paths is built. The same thing happens if you switch from one completion symbol to another.

The only difference when using the file terminator is that both the path and the file name are taken to build the matching list, whereas when using the folder terminator, only the path is used. When a folder terminator is used in one of the built-in folder manipulation commands (CD, MD, or RD), the folder terminator is always implied. The terminator also works correctly with file names that contain spaces or other special characters, as long as the matching string is enclosed in quotation marks.

Additionally, if you move the insertion point to the left and then use a trailing character within a line, the remaining text to the right of the insertion point will be discarded. Special characters that require quotation marks:<пробел>&()()^=;!"+,~". All clear?

/K- execution of a given command without subsequent completion (the console window will not close)

/Q- disable the output of commands to the screen (ECHO OFF). /R - similar to /C

/S- change the behavior of the command after /C or /K

/T: color - set the color of the text and background of the console window. The color parameter has a value in the form of two hexadecimal numbers: the first specifies the background color of the window, and the second specifies the text in the window. That is, the result of executing the command “CMD /T:7C” will be light red letters on a white background.

/U- output command execution results in Unicode format

/V:ON (/V:OFF)- allowing (disabling) delayed expansion of environment variables (for a specific cmd.exe call) using the exclamation mark "!" as a separator. For example, /V:ON allows the use of!var! as a runtime expansion of var. The var syntax is used to expand variables on input, which produces very different results inside a FOR loop. When lazy expansion of environment variables is enabled, the "!" (exclamation mark) can be used to replace the current value of an environment variable at runtime; /X - means the same as the /E:ON switch, for compatibility reasons; /Y is the same as /E:OFF. And a few more comments.

If the /C or /K switch is specified, the rest of the command line after that switch is treated as the command line, and quotation marks (") are processed as such. Quote characters on the command line are preserved if all of the following conditions are true: /S switch missing; there are exactly two quote characters; there are no other special characters between them, such as: &<>()@^|; there are one or more spaces between them; the string enclosed in quotes is the name of the executable file. Otherwise, the first character is checked and if it is a quote character, it is removed, the last quote character on the command line is also removed, and all text after that last quote character is retained.

Table for setting the text and background color of the console window:

0 - black; 1 - blue; 2 - green; 3 - blue; 4 - red; 5 - purple; 6 - 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.

By the way, color and other settings can be changed in another way. Right-click the window's title bar and select Properties. A window will open with four tabs on which options for changing program settings will be available. If you don't like the standard black command prompt screen, the Color tab allows you to choose a screen and text color either from 16 standard colors for which there are corresponding swatches, or by specifying a numeric RGB color value. On the Layout tab you can adjust the size of the window and screen buffer. If in early MS-DOS and Windows the screen size remained unchanged at 25 lines high and 80 characters long, and to display more lines you had to add the |more command, then on NT and later systems you can simply set the screen buffer size to a large enough size and use the scroll bar, which is much more convenient.

Text in the Command Prompt Window To copy and paste text into the Command Prompt window, the usual Windows keyboard shortcuts, such as Ctrl+C , Ctrl+V , will not work. To extract text from the clipboard, you will have to bring up the menu by right-clicking on the window title and select the Edit submenu. Or just right-click on the window. To copy text from the window, select Mark and use the mouse to highlight the desired text. Then either press Enter or select Copy from the same menu. If you need to paste some text into the command line window, use the Paste command. To repeat the command, use the arrows<<вверх>> and<<вниз >>, allowing you to navigate through the list of executed commands. To clear the screen of text, use the cls directive.

TITLE- to change the row header

TITLE[string] , where string is the future title of the command line window (written without quotes). Once the window title has been set, it can only be changed by calling the TITLE command again. Using this command can be useful in batch files.

Thus, executing the example below will be accompanied by the appearance of the corresponding inscription in the window title:

TITLE Files are being copied...

COPY \\Server\Share\*.doc C:\User\Common\*.doc

ECHO Copying completed.

TITLE Process completed

Team AT- With this command you can run commands and programs at specific times.

AT[\\computer name] [ | /DELETE ]

AT[\\computer name] time [ /EVERY:date[,...] | /NEXT:date [,...]] "command"

\\ computer name points to a remote computer on which scheduled tasks can run. If this parameter is not specified, then the computer on which the AT command is run is assumed by default;

id identifier assigned to the specified command;

/delete cancels the intended command. If id is omitted, all assigned commands on the computer are canceled;

/yes this option, when used with the previous option (/delete), automatically enables confirmation for all requests;

time command execution time (in 24-hour format hours:minutes);

/interactive allows the AT command to communicate with users currently connected to the system;

/every:date[,...] executes the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed;

/next:date[...] executes the specified command the next time the specified date occurs (for example, next Thursday). If no date is specified, the current day of the month is assumed by default;

"team" specifies the Windows NT command or batch program that will be executed. The file name must be specified in full. In this case, if any of the internal commands are executed, for example, COPY or DIR, and not the executable file, then it is necessary to launch the command interpreter with the / C switch, for example:

AT 10:00 "CMD /C DIR > C:\test.out.

Team For- Its capabilities are extensive, but we will limit ourselves to demonstrating only one of them - Copying over a network to all machines at once. Let's say you want to copy a file to twenty machines. This is done very quickly. First, we write a list of all machines available on the network to the list.txt file. In the console we write:

net view > c:\list.txt

Then, to perform, for example, copying the patch.exe file to each machine from the list, we issue the command:

FOR /F "tokens=1" %i in (c:\list.txt) do copy d:\temp\patch.exe "%i\C$\program files\ICQ"

The %i variable will automatically take the value of the NetBIOS machine name from the new line of the list.txt file and copy will be made to this machine.

Change the appearance of the command line prompt

cmstp.exe

Location: WINDOWS\system32

Description: Microsoft Connection Manager Profile Installer

Install or remove a Connection Manager service profile. Command executed without parameters cmstp installs a service profile with standard settings appropriate for the operating system and user permissions.

comp.exe

Location: WINDOWS\system32

Description: File Compare Utility

A byte-by-byte comparison of two or more files. Team comp allows you to compare files located on different drives and in different directories. When comparing files using the command comp their names and locations are displayed. Command executed without parameters comp requests files for comparison.

A description of the program is in Windows Help.

Syntax:

comp[file1 ] [file2 ] [ /d] [/a] [/l] [/n= number_of_lines ] [ /c]

To compare the contents of the C:\Reports directory with the contents of the backup directory \\Sales\Backup\April , enter the following command:

comp c:\reports\\sales\backup\april

To compare the first ten lines of files in the \Invoice directory and print the result in decimal format, enter the following command:

comp \invoice\*.txt \invoice\backup\*.txt /n=10 /d

compact.exe

Location: WINDOWS\system32

Description: File compression program - File Compress Utility

Display information or change compaction of files and directories on NTFS partitions. Command run without parameters compact Displays information about the compaction of files in the current directory.

A description of the program is in Windows Help.

Syntax:

compact[(/c|/u)] ] [filename[...]]

control.exe

Location: Windows\system32

Description: Windows Control Panel

This command is used to launch Control Panel applets

Tips: How to automate login

Registry: Prohibition for launching the Control Panel and its applets

convert.exe

Location: Windows\system32

Description: File System Conversion Utility

The command line utility is used to convert volumes with the FAT and FAT32 file system to volumes with the NTFS file system.

Syntax:

convert[volume] /fs:ntfs

cscript.exe

Location: Windows\system32

Description: Microsoft (r) Console Based Script Host

Script Server cscript.exe is a console option, designed to interact with the user via the command line (as opposed to the GUI application wscript.exe).

Syntax:

cscript[script_name] [server_parameters] [script_args]

There is a description of the parameters in Windows Help.

cacls.exe

Location: Windows\system32

Description: Changing access control tables - Control ACLs Program

The program is used to view or modify selective access control table (DACL) files.

A description of the program is in Windows Help.

Displaying, setting and deleting cmd.exe environment variables.

SET [variable=[string]]

variable The name of the environment variable.

string A character string assigned to the specified variable.

Type SET without parameters to display the current environment variables.

Changing the SET command when enabling enhanced command processing:

If, when calling, you specify only the variable name without an equal sign and a value,

The SET command will print the values ​​of all variables whose names begin with

from the specified line. For example:

This command will print the values ​​of all variables whose names begin with "P".

If the variable name is not found in the current environment, the SET command returns

will set the error value to ERRORLEVEL 1.

The SET command does not allow an equal sign in the name

environment variable.

The SET command supports two additional switches:

SET /A expression

SET /P variable=

The /A switch indicates that the string to the right of the equals sign is numeric

expression whose value is calculated. The expression handler is very

is simple and supports the following operations, listed in descending order

priority:

() - grouping

! ~ - - unary operators

*/% - arithmetic operators

Arithmetic operators

<< >> - binary shift

& - binary AND

^ - binary exclusive OR

| - binary OR

= *= /= %= += -= - assignment

&= ^= |= <<= >>=

Statement separator

When using any logical or binary operators, you must

enclose the expression string in quotes. Any non-numeric strings in the expression

are treated as names of environment variables whose values ​​are converted

into numerical form before use. If a variable with the specified name

is not defined in the system, a null value is substituted. This

allows you to perform arithmetic operations with the values ​​of environment variables,

Moreover, you do not need to enter % signs to get values. If the team

SET /A is called from the command line, not from a batch file, it outputs

the final meaning of the expression.

To the left of any assignment operator

must be the name of the environment variable. Numeric values ​​are treated as

decimal, unless preceded by a 0x prefix for hexadecimal numbers,

and 0 for octal numbers.

For example, the numbers 0x12,

and 022 represent the decimal number 18. Note the notation

octal numbers: 08 and 09 are not valid numbers because in

The octal number system does not use the numbers 8 and 9.

The /P switch allows you to set the value of a variable for the input string entered

user. Shows the specified promptString before reading

entered string. The promptString prompt may be empty.

Environment variable substitution can be expanded as follows:

%PATH:str1=str2%

will extend the effect of the PATH environment variable by replacing every occurrence of "str1" in

expanded result on "str2".

start of the extended output until the first occurrence of the remaining part of "str1".

You can also use extension strings.

will extend the effect of the PATH environment variable, then use only 5

characters that start with the 11th character (skipping 10) extended

result. If length is not specified, the remaining one is used by default.

variable value. If both values ​​(length and number of characters to skip)

are negative, the next value used will be the length of the variable value

environment added to the specified skip value or specified length.

will extract the last 10 characters of the PATH variable.

will extract all characters of the PATH variable except the last 2.

Finally added runtime binding support for environment variables

environment. By default this support is disabled. /V command line switch

CMD.EXE allows you to turn it on and off. To access help, type CMD /?

Runtime binding for environment variables is useful when working around

limitations of early binding, which occurs when the text is first read

line, not when executing it.

The following example demonstrates the emerging

problem when using early variable binding:

set VAR=before

If "%VAR%" == "before" (

if "%VAR%" == "after" @echo Body of the internal comparison operator

This message will not be displayed, because %VAR% in BOTH IF expressions

is substituted at the time of first use in the first IF, including in the body

the first IF branch, which is a compound expression. In IF inside

compound expression actually compares the values ​​of "before" and

"after", which is obviously false.

The following example demonstrates a similar error:

set LIST=

For %i in (*) do set LIST=%LIST% %i

in this case, the list of files in the current folder will never be built. Instead of

Therefore, the value of the LIST variable will be the name of the last found file.

Again, this happened because %LIST% is substituted only once -

at the moment of processing the FOR expression, when the list is still empty.

In fact, the above snippet is equivalent to the following example:

for %i in (*) do set LIST= %i

in which the name of the last found file is stored in the LIST variable.

Runtime binding for environment variables occurs when

runtime, then to achieve the expected results given above

the snippets should be modified as follows:

problem when using early variable binding:

set VAR=before

Set VAR=after

If "!VAR!" == "after" @echo Body of internal comparison operator

Set LIST=

For %i in (*) do set LIST=!LIST!%i

Several variables are available when enhanced command processing is enabled

environments that do not appear in the list displayed when calling the SET command.

The values ​​of these variables are calculated dynamically each time they are retrieved.

If the user explicitly defines variables with one of these names,

then this definition overlaps the corresponding dynamic definition,

described below:

%CD% - expands to the current directory line.

%DATE% - Expands to the current date using the same DATE command format.

%TIME% - expands to the current date using the TIME command format.

%RANDOM% - expands to a random decimal number between 0 and 32767.

%ERRORLEVEL% - expands to the current ERRORLEVEL value

%CMDEXTVERSION% - expands to the current version value

advanced command processing.

%CMDCMDLINE% - Expands to the original command line that called

command processor.

    Team SETLOCAL used to temporarily change the values ​​of environment variables in Windows batch files. Environment changes made after running the SETLOCAL command are local to the current batch file. To restore their previous values, you must issue the ENDLOCAL command. When the end of the batch file is reached, the ENDLOCAL command is automatically executed for all valid SETLOCAL commands issued in that batch file, and the values ​​of all environment variables are restored to the state before the SETLOCAL command was executed.

Command line format:

SETLOCAL | ENABLEDELAYEDEXPANSION | DISABLEDELAYEDEXPANSION

Changing the SETLOCAL command when enabling extended command processing:

The SETLOCAL command accepts optional arguments: ENABLEEXTENSIONS or DISABLEEXTENSIONS. This allows you to enable or disable advanced command processing before the command is executed. See cmd /? for a detailed explanation. ENABLEDELAYEDEXPANSION / DISABLEDELAYEDEXPANSION Enables or disables delayed environment variable expansion. See SET /? for a detailed explanation. These changes are in effect until the ENDLOCAL command is matched, regardless of the initial state before the SETLOCAL command was called.

If the SETLOCAL command is called with an argument, it sets the error code ERRORLEVEL. If one of the two valid arguments is given, the error code will be zero, otherwise 1 will be returned. This property can be used in batch files to determine whether extended command processing is available, for example:

VERIFY OTHER 2>nul
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 echo Unable to enable advanced processing

This group of commands works because in previous versions of CMD.EXE the SETLOCAL command did not set the value to ERRORLEVEL. A VERIFY command with an invalid argument is required to set ERRORLEVEL to a non-zero value.

When using environment variables in command files, there is a certain limitation associated with the fact that the assigned value remains unchanged when it is modified within a group of commands specified by parentheses, for example in commands IF or FOR. To bypass this limitation, launch the command processor with the /V:ON parameter and use exclamation marks instead of percent signs to obtain the value accepted by the variable. In addition, it is possible to use the standard launch of the command processor, but with local activation of this mode with the command:

The difference in the results of using variable values ​​is quite clearly demonstrated by the following batch file:


@ECHO OFF
set VAR=before
if "%VAR%" == "before" (
set VAR=after
if "!VAR!" == "after" @echo With percent sign=%VAR% , With question mark=!VAR!

Team set VAR=after executed inside a subroutine delimited by parentheses and, if the command is removed Setlocal EnableDelayedExpansion or not to use to get the value of a variable VAR exclamation marks, its value will remain the old one (what was set before entering the subroutine). A similar problem occurs when the value of a variable is changed within the command loop. FOR. For example, to get a list of files in the current directory, a batch file like this won't work:

set LIST=
for %%i in (*) do set LIST=%LIST% %%i
echo %LIST%

Variable value LIST will not be changed inside the loop. In order for this to happen, the batch file needs to be modified as follows:

Setlocal EnableDelayedExpansion
set LIST=
for %%i in (*) do set LIST=!LIST! %%i
echo %LIST%
Now, the value of the variable LIST inside a loop FOR will change, sequentially taking on the values ​​of file names separated by space ( set LIST=!LIST! %%i)


Displaying, setting and deleting cmd.exe environment variables.

SET [variable=[string]]

variable The name of the environment variable.
string A character string assigned to the specified variable.

Type SET without parameters to display the current environment variables.

Changing the SET command when enabling enhanced command processing:

If, when calling, you specify only the variable name without an equal sign and a value,
The SET command will print the values ​​of all variables whose names begin with
from the specified line. For example:

SET P

This command will print the values ​​of all variables whose names begin with "P".

If the variable name is not found in the current environment, the SET command returns
will set the error value to ERRORLEVEL 1.

The SET command does not allow an equal sign in the name
environment variable.

The SET command supports two additional switches:

SET /A expression
SET /P variable=

The /A switch indicates that the string to the right of the equals sign is numeric
expression whose value is calculated. The expression handler is very
is simple and supports the following operations, listed in descending order
priority:


When using any logical or binary operators, you must
enclose the expression string in quotes. Any non-numeric strings in the expression
are treated as names of environment variables whose values ​​are converted
into numerical form before use. If a variable with the specified name
is not defined in the system, a null value is substituted. This
allows you to perform arithmetic operations with the values ​​of environment variables,
Moreover, you do not need to enter % signs to get values. If the team
SET /A is called from the command line, not from a batch file, it outputs
the final meaning of the expression. To the left of any assignment operator
must be the name of the environment variable. Numeric values ​​are treated as
decimal, unless preceded by a 0x prefix for hexadecimal numbers,
and 0 for octal numbers. For example, the numbers 0x12,
and 022 represent the decimal number 18. Note the notation
octal numbers: 08 and 09 are not valid numbers because in
The octal number system does not use the numbers 8 and 9.

The /P switch allows you to set the value of a variable for the input string entered
user. Shows the specified promptString before reading
entered string. The promptString prompt may be empty.

Environment variable substitution can be expanded as follows:

%PATH:str1=str2%

will extend the effect of the PATH environment variable by replacing every occurrence of "str1" in
expanded result on "str2". "str2" can be an empty string for
effectively removing occurrences of "str1" from the expanded output. "str1" can
start with an asterisk, in which case it will match any
start of the extended output until the first occurrence of the remaining part of "str1".

You can also use extension strings.

%PATH:~10.5%

will extend the effect of the PATH environment variable, then use only 5
characters that start with the 11th character (skipping 10) extended
result. If length is not specified, the remaining one is used by default.
variable value. If both values ​​(length and number of characters to skip)
are negative, the next value used will be the length of the variable value
environment added to the specified skip value or specified length.

%PATH:~-10%

will extract the last 10 characters of the PATH variable.

%PATH:~0.-2%

will extract all characters of the PATH variable except the last 2.

Finally added runtime binding support for environment variables
environment.
By default this support is disabled. /V command line switch
CMD.EXE allows you to turn it on and off. To access help, type CMD /?

Runtime binding for environment variables is useful when working around
limitations of early binding, which occurs when the text is first read
line, and not when executing it. The following example demonstrates the emerging
problem when using early variable binding:

set VAR=before
if "%VAR% " == "before" (
set VAR=after
if "%VAR%" == "after" @echo Body of the internal comparison operator
)

This message will not be displayed, because %VAR% in BOTH IF expressions
is substituted at the time of first use in the first IF, including in the body
the first IF branch, which is a compound expression. In IF inside
compound expression actually compares the values ​​of "before" and
"after", which is obviously false. The following example demonstrates a similar error:

set LIST=
for %i in (*) do set LIST=%LIST% %i
echo%LIST%

in this case, the list of files in the current folder will never be built. Instead of
Therefore, the value of the LIST variable will be the name of the last found file.
Again, this happened because %LIST% is substituted only once -
at the moment of processing the FOR expression, when the list is still empty.
In fact, the above snippet is equivalent to the following example:

for %i in (*) do set LIST=%i

in which the name of the last found file is stored in the LIST variable.

Runtime binding for environment variables occurs when
using a special character (exclamation mark) to indicate
performing the comparison at runtime. If linking support is enabled
runtime, then to achieve the expected results given above
the snippets should be modified as follows:

set VAR=before
if "%VAR% " == "before" (
set VAR=after
if "!VAR! " == "after" @echo Body of the internal comparison operator
)

set LIST=
for %i in (*) do set LIST=!LIST!
echo%LIST%

%i
Several variables are available when enhanced command processing is enabled
environments that do not appear in the list displayed when calling the SET command.
The values ​​of these variables are calculated dynamically each time they are retrieved.
If the user explicitly defines variables with one of these names,
described below:

then this definition overlaps the corresponding dynamic definition,

%CD% - expands to the current directory line.

%DATE% - Expands to the current date using the same DATE command format.

%TIME% - expands to the current date using the TIME command format.

%RANDOM% - expands to a random decimal number between 0 and 32767.

%ERRORLEVEL% - expands to the current ERRORLEVEL value

%CMDEXTVERSION% - expands to the current value of the extended command processing version.
command processor.

%CMDCMDLINE% - Expands to the original command line that called

Environment variables set in my Windows XP, which has been living for 2 years without reinstallation:
%ALLUSERSPROFILE% = C:\Documents and Settings\All Users
%CommonProgramFiles% = C:\Program Files\Common Files
%COMPUTERNAME% = "Computer name"
%ComSpec% = C:\WINDOWS\system32\cmd.exe
%CYGWIN% = tty
%FP_NO_HOST_CHECK% = NO
%NUMBER_OF_PROCESSORS% = 2
%OS% = Windows_NT
%Path% = C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOW S\System32\Wbem
%PATHEXT% = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.W SF;.WSH
%PROCESSOR_ARCHITECTURE% = x86
%PROCESSOR_IDENTIFIER% = x86 Family 6 Model 15 Stepping 2, GenuineIntel
%PROCESSOR_LEVEL% = 6
%PROCESSOR_REVISION% = 0f02
%ProgramFiles% = C:\Program Files
%PROMPT% = $P$G
%SystemDrive% = C:
%SystemRoot% = C:\WINDOWS
%TEMP% = C:\DOCUME~1\"Username"\LOCALS~1\Temp
%TMP% = C:\DOCUME~1\"Username"\LOCALS~1\Temp
%USERDOMAIN% = "Computer name"
%USERNAME% = "Username"
%USERPROFILE% = C:\Documents and Settings\"Username"

%windir% = C:\WINDOWS Command line

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.