What is the Windows analog of the Linux watch command?

Write your own. Let's say file watch.bat contains :

@ECHO OFF
:loop
  cls
  %*
  timeout /t 5 > NUL
goto loop

and call it via, for example:

watch echo test

will echo test every 5 seconds.


Powershell has the "while" command. You can use it like in Linux:

while (1) {your_command; sleep 5}

Linux version:

while true; do your_command; sleep5; done

Others:

while ($true) {netstat -an | findstr 23560; sleep 5; date}


watch is available in Cygwin, in the procps package as listed here (this info can be found via the package search on the website, here). I don't think this package is installed by the default cygwin setup, but it is one I usually select on new installs in order to have the watch command available.

The location of tools in packages usually match package names in Linux distributions (the package containing watch is procps on Debian and Ubuntu too) so if the Cygwin package search function fails you, info for/from Linux distributions may offer clues.