Last active
June 24, 2025 21:09
-
-
Save st1vms/ac62013d707edcb81acbda7c56d7e083 to your computer and use it in GitHub Desktop.
Linux "watch" command equivalent for Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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