Link Search Menu Expand Document


This one is about Microsoft Batch script language.


Command Content
cd X Move to folder X
REM Comments / Remarks
echo Write to console
@echo off Don’t write script content to console
a & b Do a and b commands in parallel
a && b Do a and b commands in serial


  • Set and use a variable

      set message=Hello World
      REM Spaces are significants
      echo %message%
Environment variables Content
%COMPUTERNAME% Computer name


if var1 == var (
    echo do something
) else (
    echo do else

Files & Folder

  • Folder
    • Create mkdir
  • Files & folder
    • Rename REN or rename
  • Variables stored into a file
    • Save echo %var%>filename
    • Load set /p var=<filename
  • Test if something exists
    • File if exist filename (...)
    • Folder if exist folder\ (...)


There’s several ways to launch an app:

  • start
  • call

Somewhat related: if you want to pass a command in a LNK shortcut to the command line, use cmd.exe /k yourcommand