BAT file (some commands)

ECHO : write on CMD (MS DOS) screen

@ECHO : @ at the beginning mean “do not show this command on running screen”

@REM :  “NOTE sentence” – write a note in a batch file.

:POINT1  : Denote a point in batch file

GOTO POINT1 : jump to POINT1, skip all command below GOTO and above POINT1

@ECHO This text > file.txt : overwrite file

@ECHO Thi text >> file.txt : append to the file

%VARIABLE%  : variable in batch file, locate between %…%

@SET VAR=This Value   : assign variable in batch file

@SET VAR=%VAR% and This Text    (new VAT is “This Value and This Text”)

@SET VAR=2

@SET /A VAR=%VAR%+1 (/A mean attribute, result is VAR is 2 + 1 = 3)

@IF %VAR%==0 (command) ELSE (command)

@IF %VAR%==0 DO (command)

@ECHO This Text>File.txt  :  ECHO command writes text to file with ANSI encoding

@wmic.exe /APPEND:File.txt /NODE:%PC_Name% CPU GET SYSTEMNAME  :  WMIC command writes text to file with UNICODE encoding.

 

Advertisements