\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{ChaosJD (ChaosJD)} \pdfinfo{ /Title (batch.pdf) /Creator (Cheatography) /Author (ChaosJD (ChaosJD)) /Subject (Batch Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{36A315} \definecolor{LightBackground}{HTML}{F2F9F0} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Batch Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{ChaosJD (ChaosJD)} via \textcolor{DarkBackground}{\uline{cheatography.com/99440/cs/21487/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}ChaosJD (ChaosJD) \\ \uline{cheatography.com/chaosjd} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 22nd October, 2020.\\ Updated 22nd October, 2020.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Help}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{help commandName} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{commandName /?} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{help -{}-\textgreater{} show all system commands} \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{All System Commands}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{help} \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{4.32999 cm} p{0.64701 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Clear Screen}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Cl}}ear {\bf{S}}creen & cls \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Shortcuts}} \tn % Row 0 \SetRowColor{LightBackground} Tab & Autocomplete \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} arrow keys up/down & back/forward history commands \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Control + C & stops current command \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} ALT + F7 & clears the history \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} F7 & shows the history \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Directory Make \& Remove}} \tn % Row 0 \SetRowColor{LightBackground} mkdir \{\{nl\}\} subdirectory & creates new subdirectory \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} mkdir \seqsplit{subdir/subsubdir} & creates subdir \& subdir/subsubdir \{\{nl\}\}{\bf{Hint:}} creates it, if they aren't existing \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} \{\{bt\}\}rmdir & \{\{bt\}\}removes an {\bf{empty}} dir \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} rmdir /s directory & removes directory {\bf{with}} content \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} rmdir /s /q directory & removes directory {\bf{with}} content \& {\bf{skips y/n}} question \tn % Row Count 13 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.04057 cm} x{2.93643 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Directory copy}} \tn % Row 0 \SetRowColor{LightBackground} copy src dst & copy files \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} copy /Y src dest & copy files overwrites {\bf{without}} quesiton \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} xcopy /s src dest & copies dirs {\bf{and}} subdirs {\bf{except}} empty ones \tn % Row Count 6 (+ 3) % Row 3 \SetRowColor{white} xcopy /YS src dest & as above {\bf{without}} ask to overwrite \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} xcopy /YS src \textbackslash{}\textbackslash{}server\textbackslash{}share & copy to network share \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} robocopy /S src dest & copies dirs and subdirs except empty ones \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} robocopy /YS src dest & as above without ask to overwrite \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Parameters}} \tn % Row 0 \SetRowColor{LightBackground} \%0 & Name of Script \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \%1 ... \%9 & Parameter 1 ... Parameter 9 \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \%* & prints all parameters as a string \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} ({\bf{one line}})\{\{nl\}\}for \%\%x in (\%*) do echo \%\%x & access it through a for loop works with \textgreater{} 10 parameters \tn % Row Count 8 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Pass Parameters to sub script}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{parameters\_script}.bat & @echo off\{\{nl\}\}call \seqsplit{parameters\_subscript.bat} \%*\{\{nl\}\}EXIT /B \%errorlevel\% \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \seqsplit{parameters\_subscript}.bat & @ECHO off\{\{nl\}\}echo subscript called with \%*\{\{nl\}\}EXIT /B 0 \tn % Row Count 7 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{EXIT /B specifies to exit the current batch scropt instead of cmd.exe. If executed from outside a batch script, it will quit cmd.exe} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.58804 cm} x{2.38896 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Arrays Way2}} \tn % Row 0 \SetRowColor{LightBackground} set array{[}0{]}=0\{\{nl\}\}set array{[}1{]}=1\{\{nl\}\}... & set value to a specific array element \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} echo \%array{[}0{]}\%\{\{nl\}\}echo \%array{[}1{]}\% & access to array elements \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{missing loop over elements: indexed} \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Functions: label and goto}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{echo "Hi:"\{\{nl\}\}goto :good} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{bt\}\}:bad\{\{nl\}\}echo "I don't like scripting"\{\{nl\}\}goto :eof} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{bt\}\}:good\{\{nl\}\}echo "I like scripting"\{\{nl\}\}goto :eof} \tn % Row Count 5 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DoubleClickExecution}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{@ECHO off \newline % Row Count 1 (+ 1) setlocal \newline % Row Count 2 (+ 1) REM check for interactive sesseion \newline % Row Count 3 (+ 1) SET interactive=0 \newline % Row Count 4 (+ 1) ECHO \%CMDCMDLINE\% | FINDSTR /L \%COMSPEC\% \textgreater{}NUL 2\textgreater{}\&1 \newline % Row Count 6 (+ 2) IF \%ERRORLEVEL\% EQ SET interactive=1 \newline % Row Count 7 (+ 1) ECHO do work \newline % Row Count 8 (+ 1) REM pause if interactive (double-clicked execution) \newline % Row Count 10 (+ 2) IF "\%ineractive\%" == "0" PAUSE \newline % Row Count 11 (+ 1) EXIT /B 0% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{FINDSTR /L is use search string literally} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.60195 cm} x{1.73926 cm} x{1.23579 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Navigation}} \tn % Row 0 \SetRowColor{LightBackground} realative & parent directory & cd .., cd.. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} & subdirectory & cd \seqsplit{subdirectoy} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \{\{bt\}\}absolute & \{\{bt\}\}cd C:\textbackslash{}Windows & \{\{bt\}\} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} & cd \textbackslash{}Windows & \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} \{\{bt\}\}change drive & \{\{bt\}\}Z: & \{\{bt\}\} \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.39356 cm} x{3.58344 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Wildcards}} \tn % Row 0 \SetRowColor{LightBackground} ? \seqsplit{(file?.txt)} & one arbitary character \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} * ( *.bat) & arbitary characters (0,1 or more) \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14471 cm} x{3.83229 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{File Show}} \tn % Row 0 \SetRowColor{LightBackground} type file & show file content \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} more & show file content {\bf{pagewise}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} sort file & show file content sorted \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.29402 cm} x{3.68298 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Directory show Content}} \tn % Row 0 \SetRowColor{LightBackground} current folder & dir \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} absolute path & dir C:\textbackslash{}Windows \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} dir Y: & different drive \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} dir /B & only show file names and directory names \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{3.03597 cm} x{1.94103 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Batch Files User Input}} \tn % Row 0 \SetRowColor{LightBackground} @ echo off\{\{nl\}\}set /P name="Input yor name: " & Syntax: set /P var=prompt: \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} echo Hi \%name\% & variable call \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.9862 cm} x{1.9908 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Batch Files File Input}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{@echo off\{\{nl\}\} echo Bill \textgreater{} file\{\{nl\}\}echo Gate \textgreater{}\textgreater{} file} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} set /P filecontent =\textless{} file\{\{nl\}\}echo First Line: \%filecontent\% & set /P var=\textless{} file \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} FOR /f \%\%f in (file) Do (\{\{nl\}\} echo \%\%f\{\{nl\}\}) & REM print each line in file \tn % Row Count 8 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Variables}} \tn % Row 0 \SetRowColor{LightBackground} setlocal\{\{nl\}\}set MY\_ENV=abc\{\{nl\}\}endlocal & Only active in the current batch file (local) \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} set MY\_ENV=abc & creates or changes an environment variable that is active in the cmd. (global) \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} set & shows the active environment variables \tn % Row Count 9 (+ 2) % Row 3 \SetRowColor{white} echo \%USERNAME\% & print variable out \tn % Row Count 10 (+ 1) % Row 4 \SetRowColor{LightBackground} defined MY\_VAR & returns\{\{nl\}\}0 =\textgreater{} Execution was successful\{\{nl\}\}\textgreater{}0 =\textgreater{} Execution failed \tn % Row Count 14 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{4.18068 cm} p{0.79632 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{IF Control Structures}} \tn % Row 0 \SetRowColor{LightBackground} IF test (command) ELSE (command) & \seqsplit{Syntax} \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Control structures For}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{for \{\%\%|\%\}\textless{}Variable\textgreater{} in (\textless{}Set\textgreater{}) do \textless{}Command\textgreater{} {[}\textless{}CommandLineOptions\textgreater{}{]}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{cmd.exe use -\textgreater{}{\bf{\%}}} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{batch script use -\textgreater{}{\bf{\%\%}}} \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Functions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{call :print\_name Florian} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{echo print\_name exitst with \%errorlevel\%} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{goto :eof} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{bt\}\}:printname\{\{nl\}\}echo Hit \%1\{\{nl\}\}exit /B 0 \textless{}- REM sets exit status of :print\_name} \tn % Row Count 5 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64241 cm} x{3.33459 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{File Rename \& Move}} \tn % Row 0 \SetRowColor{LightBackground} rename file1 file2 & renamef filte1 to file2 \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \{\{bt\}\}move file1 dir & move file 1 to dir (path dir/file1) \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} move file1 dir/file2 & moves and renames file1 to file2 (path: dir/file2) file2 is overwritten from file1 \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} move /Y file1 file2 & moves and overwrites file1 to file2 {\bf{without}} asking \tn % Row Count 11 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{File Names}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Case-Insensitive} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Max. 260 characters incl. invisible terminating null character} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{spaces and character set 128 - 255 allowed} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Never}} \textless{}, \textgreater{}, :, ", /, \textbackslash{}, |, ?, *} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\emph{Hint:}} A-Z, a-z, 0-9, \_, spaces, ( underscore as space )} \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{*.bat \& *.cmd} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{dir /B -{}-\textgreater{} only show file names and directory Names} \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64241 cm} x{3.33459 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Directory Rename \& Move}} \tn % Row 0 \SetRowColor{LightBackground} rename dir1 dir2 & renames dir1 in dir2 \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \{\{bt\}\}move dir1 dir2 & \{\{bt\}\}if {\bf{dir2 exist:}} dir1 into dir2 (path: dir2/dir1), {\bf{else}} rename dir1 to dir2 \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} move file1 dir/file2 & file 2 is deleted. file1 get the name of file2 ans is set at the position of file2 {\bf{with}} asking (Yes/No/All) \tn % Row Count 11 (+ 5) % Row 3 \SetRowColor{white} move /Y file1 file2 & file 2 is deleted. file1 get the name of file2 ans is set at the position of file2 {\bf{without}} asking. \tn % Row Count 15 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{File Redirects}} \tn % Row 0 \SetRowColor{LightBackground} type file.txt | sort & give {\bf{output of}} type to sort \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} sort \textless{} file.txt & give content ( stdin) of file.txt \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} echo "hi" \textgreater{} file.txt & {\bf{write}} "hi" (stout) {\bf{to}} file.txt \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} type NUL \textgreater{} file.txt & {\bf{create empty file}}\{\{fa-exclamation-triangle\}\} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} rm file 2\textgreater{} errors.txt & {\bf{redirects}} errors(stderr) ro errors.txt \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} rm file 2\textgreater{} NUL & {\bf{discard }} errors \tn % Row Count 11 (+ 1) % Row 6 \SetRowColor{LightBackground} rm file 2\textgreater{}\&1 & {\bf{redirect}} stderr to stdout \tn % Row Count 13 (+ 2) % Row 7 \SetRowColor{white} echo "you" \textgreater{}\textgreater{} file.txt & {\bf{append}} "you" to file.txt \tn % Row Count 15 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4977 cm} x{4.4793 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Comment}} \tn % Row 0 \SetRowColor{LightBackground} REM & Pr{\"a}fix after them the text \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Calculation}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{set /a i=0\{\{nl\}\}echo i=\%i\%} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{set /a {\bf{i=1+1}} Operatoren +, -, *, /} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{set /a {\bf{i+=1}} Operatoren +, -, *, /} \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.78712 cm} x{2.18988 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Arrays Way1}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{set {\bf{array=1}} 2 3 4\{\{nl\}\}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \%array\% & (echo) all Array elements \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} for \%\%a in (\%array\%) do (\{\{nl\}\}echo\%\%a\{\{nl\}\}) & loop over elements \tn % Row Count 6 (+ 3) % Row 3 \SetRowColor{white} set array={\bf{(and nothing else)}} & unset {\bf{variable}} or {\bf{array}} \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.09848 cm} p{0.54924 cm} x{2.92928 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Control Structures: Comparison Operators}} \tn % Row 0 \SetRowColor{LightBackground} Operator & Info & Equal \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} EQU & == & Equal \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} NEQ & != & Not equal \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} LSS & \textless{} & Less \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} LEQ & \textless{}= & Less than or equal to \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} GTR & \textgreater{} & Greater than \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} GEQ & \textgreater{}= & Greater than or equal \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} NOT & ! & Not \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Editors}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Notepad} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Notepad++} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{VisualStudioCode} \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Editors}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Notepad} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Notepad++} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{VisualStudioCode} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Atom} \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Terminals}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{cmd.exe} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Windows Terminal} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{ConEmu} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{cmder} \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.54287 cm} x{3.43413 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Batch Filex Exit / Return}} \tn % Row 0 \SetRowColor{LightBackground} Specify exit code: & echo "abc"\{\{nl\}\}exit 0 \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Query error level & echo \%ERRORLEVEL\% \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Exit/Return codes & 0 =\textgreater{} Execution was successful\{\{nl\}\}\textgreater{}0 =\textgreater{} Execution fiales with code X \tn % Row Count 7 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}