Skip to content

Instantly share code, notes, and snippets.

@st1vms
Last active June 24, 2025 21:09
Show Gist options
  • Save st1vms/ac62013d707edcb81acbda7c56d7e083 to your computer and use it in GitHub Desktop.
Save st1vms/ac62013d707edcb81acbda7c56d7e083 to your computer and use it in GitHub Desktop.
Linux "watch" command equivalent for Windows
@ECHO OFF
IF "%~1"=="" (
ECHO Usage: %~nx0 seconds command [args...]
GOTO :EOF
)
SET "WAIT=%~1"
SHIFT
:build_command
SET "CMD=%~1"
SHIFT
:append_args
IF "%~1"=="" GOTO :run_loop
SET "CMD=%CMD% %~1"
SHIFT
GOTO append_args
:run_loop
:loop
CLS
CALL %CMD%
TIMEOUT /T %WAIT% >NUL
GOTO loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment