Вы находитесь на странице: 1из 7

3-4

: .bat .

Dir
. dir
,
, ,
dir [:][][_] [...] [/p] [/q] [/w] [/d] [/a[[:]]]
[/o[[:]_]] [/t[[:]_]] [/s] [/b] [/l] [/n] [/x] [/c] [/4]
[:][] - , .
[_] - , .
:
/s -
.
/b - ( )
.
Echo
Echo [{on|off}] [] -
.
Find
FIND [/V] [/] L7N] [/I] [/OFFCLINE]] "" [[:][]_[ ...]]
. :
[1:][1]_ ,
;
, ;
/I ;
For
.
for {%|%%} in () do
[]
{%|%%} - . . %
% for .
, , %A, %B %C.
() - . , ,
, .
.
- . ,
, ,
().
- ,
.
tokens=x,y,m-n , for
. .
m-n , m- n-.
tokens= (*),

,
.
:
%~pI - %I .
%~nI - %I .
%~nxI - %I .
:
for /R [[ :]] {%% | %} in () do
[]
[:],
for . /R
, .
(.),
for /L {%% | %} in (#,#,#) do
[]
,
(#),
,
(#). /L ,
# #.
# #,
.
#, .
#
. , (1,1,5) 1 2 3 4 5,
(5,-1,1) 5 4 3 2 1.
.

/F . ,
,
. for
, . /F
.
. .
for /F [""] {%% | %} in
() do []
for /F [""] {%% | %} in ("")
do []
for /F [""] {%% | %} in ('') do
[]
.
,
.

Goto
goto :
Windows XP , .
, .
- , .
If
.

if [not] errorlevel [else ] if [not] 1==2


[else ] if [not] exist _ [else ]
,
: if [/i] 1 _ 2 [else ] if
cmdextversion [else ] if defined [else
]
not - .
errorlevel - , ,
Cmd.exe, , .
- , .
exist _ - , _.
:
EQU -
NEQ -
RAR
RAR <> -< 1> -< N> <> <...> <@...> <__\>
:
a -
l[t,b] - [, ]
x -
Set
SET =
,
.
SET = .
- , .
, ,

.
. ( batch - ).
, :
, , .
. DOS
,
. ,
, , ,
DOS. ,
. :
DOS, , ,
,
, .
( )
, .
,

, ,
.

, ,
.
() Windows
bat, ,
( ) .
ECHO []
(,
..). ,
ECHO ! > hi.txt
.
,
. ECHO OFF
. ECHO ON .
, ,
@. , , ECHO. (
).
@ECHO OFF
ECHO !
ECHO.
ECHO

, .

BAT echo:
.
ECHO [ON | OFF]
ECHO []
ECHO
.
BAT :

echo
echo hello batch files
.

, Echo .
. .
echo off
echo hello batch files
.

. , CLS(
) . CLS
MS DOS .
echo off
cls
echo hello batch files
.

, .

) bat- ,
c: all.txt ( c:\temp
)
@echo off
subst x: c:\temp
dir >x:\all.txt
type x:\all.txt
) , c:\Winnt .
@echo off
dir /O:-S c:\winnt | more

) bat-, txt
: .
@echo off
for %%i in (*.txt) do type type *.txt
) bat-, Winnt c:,
x, withx.txt
@echo off
dir *.?x* > c:\temp\withx.txt
). bat-, , x,
x.txt
@echo off
dir *.*x* > x.txt
). c:
.
@echo off
dir /O:D c: | more
) r p.
@echo off
break on
SET A=
:start
rename %A%r*.* %A%p*.*
SET A=%A%?
goto start
) bat-, :
@echo off
break on
SET A=
:loop
SET A=%A%aa
echo %A%
goto loop
: pause
) :
1
2
:__
( .bat):

@echo off
:main
echo 1 -
echo 2 -
set /p sym=:
if %sym%==1(echo !&&echo ?) else (echo !)
if %sym%==2(goto exit)
goto main
:exit
Exit

@echo off
title Test
color a
echo Hi!
echo how are you?
:start
echo Enter 1, 2, 3
set /p a=Enter:
if %a%==1 (start calc.exe&&cls&goto start)
if %a%==2 (start mspaint&&cls&goto start)
if %a%==3 (exit)