Windows CMD Shell How-to guides and examples
Evaluate expressions
Shortcuts
Example Batch Files and functions
| 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 |
Upper or 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. |
| Whereis.cmd |
Display full path to any executable file. |
| xlong.cmd |
Find filenames that exceed the 256 char pathname limit. |
Reference
| ANSI colours |
Use ANSI colours in the Windows 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 / colour |
| 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. |
| OOBE |
Setup Windows 11 with a local account. |
| 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. |
| 64 Bit |
Detect a 64 bit / 32 bit OS or Process. Run a 64 bit program from a 32 bit process. |
Related:
See also: Websites, Toolkits, Package managers, Apps, Utilities and Books for Microsoft Windows.
Batch File Scripting Techniques - Rob van der Woude.
Copyright © 1999-2026
SS64.com
Some rights reserved