batch-fileDifferences between Batch (Windows) and Terminal (Linux)


Batch and bash are quite different. Batch flags are indicated with a /, while bash flags use a -. Capitalization matters in bash, but (almost) not at all in batch. Batch variable names can contain spaces, bash variable names can not. Ultimately, both are ways of manipulating and interacting with the command line. Not surprisingly, there is a reasonably-sized amount of overlap between the capabilities of the two systems.


  • bitsadmin is deprecated in favor of the PowerShell cmdlet BITS but still works as of Windows 10 version 1607
  • certutil separates pairs of hexadecimal digits with a space, so md5sum will return an example value of d41d8cd98f00b204e9800998ecf8427e, while certutil displays the same value as d4 1d 8c d9 8f 00 b2 04 e9 80 09 98 ec f8 42 7e
  • To cd to another drive (for example, from C: to D:) the /d flag must be used
  • del can not delete folders, use rm instead
  • grep is so much more powerful than find and findstr, it's almost not fair to compare them; find has no regex capabilities and findstr has extremely limited regex capabilities ([a-z]{2} is not valid syntax, but [a-z][a-z] is)
  • for loops on the Windows command prompt can only use single-character variable names; this is the only time batch variable names are case-sensitive
  • for loops on the command prompt also use the variable form %A instead of %A% - forloops in batch scripts use the variable form %%A
  • md automatically creates any necessary parent directories, while mkdir needs the -p flag to do so
  • rem may not be used as an inline comment character unless it is preceded by a &
  • :: may not be used as an inline comment at all, and should also not be used inside of a code block (set of parentheses)
  • Note that some Windows command like ping still uses - as flags