Parameters Command Line Arguments %1 %~f1 Array Variables Create pseudo-array variables. Env. Variables Variable types, arrays and a list of all standard environment variables. functions How to package blocks of code. AND/OR Logic Conditional Execution (If-Then-Else) Loops Loops and Subroutines. Macros Embed blocks of code in a variable. Redirection Spooling output to a file, piping input. Services List of Windows 10 Services (1903).
Using brackets to Group and expand expressions. Delayed Expansion Variables within loops. Escape chars delimiters and quotes SET /A Environment variable arithmetic. VarSubstring Extract part of a variable (substring). VarSearch Search & replace part of a variable. RANDOM Random Numbers. Wildcards Match multiple files.
Keyboard shortcuts For CMD, PowerShell and Windows. RUN commands Start | Run commands. MMC Snap-ins Admin commands. ms-settings Shortcuts to settings. Shell: folder Shortcuts to key folders. ProfileFolders User profile folders: Start Menu, Roaming etc.
Run a script How to create and run a batch file. Also VBS and .ps1 scripts. Banner Display a string of text in extra large letters. Elevate/UAC Run with elevated permissions (As Admin). DateMath Add or subtract days from any date. DeQuote Remove quotes from a string. DelOlder Delete files more than n days old. Empty Find out if a directory is empty GenChr.cmd Generate an ASCII/Unicode character. GetDate.cmd Get todays date (any region, any OS.) GetTime.cmd Get the time now. GetGMT.cmd Time adjusted to Greenwich Mean Time. IsDirectory.cmd Check if a path leads to a folder or a file. StampMe.cmd Rename a file with the date/time. StrLen Calculate the length of a string. ToLower.cmd Lower case a String. tdiff.cmd Calculate the difference in Hours/Mins between two time values. timer.cmd Measure the run time of a script. Which.cmd Display full path to any executable file. xlong.cmd Find filenames that exceed the 256 char pathname limit.
ANSI colors Use ANSI colors in the Windows 10 terminal. Autoexec Run commands at startup. CMD Shell Working in the Windows CMD shell. CMD Internal Commands that are Internal to the CMD shell. Compatibility Backwards compatibility - runas admin / color Errorlevel Errorlevel and Exit codes in CMD (set and detect errors) Error Handling Error Handling in a batch file. Slow Browsing Speed up network browsing. LAN Mgr auth NTLM authentication. Logon Types Windows Logon types. Long Filenames Long filename issues (>256 chars) and legal filename /host name/computer name characters. Display DPI Monitor size settings. Share modes An explanation of File Sharing modes. File Shares Organising shared files. NoDrives Hide mapped drives from Windows Explorer. % vs %% Why you need to double the %'s in a batch file. Printing Printer connections and print drivers. Recovery The Windows Recovery Environment (WinRE), Safe mode and Win PE. Reg Tweaks Registry tweaks and settings. BuiltIn Groups Built-In Users and Security Groups. AD Groups Local Domain groups, Global and Universal groups. 64Bit Detect 64 bit vs 32 bit Windows.
See also: Websites, Resource Kits, Books and Utilities for Microsoft Windows.
Batch File Scripting Techniques - Rob van der Woude.