:: save as pause-demo.bat
@echo off
echo Hello from CMD
pause
:: save as pause-demo.bat
@echo off
echo Hello from CMD
pause
:: save as pause-demo.bat
@echo off
echo Hello from CMD
pause
# pause-demo.ps1
Read-Host 'Press Enter to continue'
# pause-demo.ps1
Read-Host 'Press Enter to continue'
# pause-demo.ps1
Read-Host 'Press Enter to continue'
# pause-any-key.ps1
Write-Host 'Press any key to continue...'
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
# pause-any-key.ps1
Write-Host 'Press any key to continue...'
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
# pause-any-key.ps1
Write-Host 'Press any key to continue...'
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
#!/usr/bin/env bash
read -r -n 1 -s -p $'Press any key to continue...\n'
#!/usr/bin/env bash
read -r -n 1 -s -p $'Press any key to continue...\n'
#!/usr/bin/env bash
read -r -n 1 -s -p $'Press any key to continue...\n'
#!/usr/bin/env bash
if [ -t 0 ]; then read -r -n 1 -s -p $'Press any key to continue...\n'
fi
#!/usr/bin/env bash
if [ -t 0 ]; then read -r -n 1 -s -p $'Press any key to continue...\n'
fi
#!/usr/bin/env bash
if [ -t 0 ]; then read -r -n 1 -s -p $'Press any key to continue...\n'
fi
#!/bin/sh
printf 'Press Enter to continue... '
read -r _
#!/bin/sh
printf 'Press Enter to continue... '
read -r _
#!/bin/sh
printf 'Press Enter to continue... '
read -r _ - -n 1 — read one character
- -s — silent (no echo)
- -r — raw (backslash not special)
- -p — prompt string - Windows CMD — pause
- PowerShell — ReadKey or Read-Host
- Unix — read with [ -t 0 ] guard - Bash cheat sheet — general command reference
- PowerShell cheatsheet — cmdlets and everyday usage - GNU Bash manual — Bash Builtins — read
- Microsoft Learn — Read-Host and console APIs for advanced hosts