Batch Script in Windows 10


Background

Batch script in Windows 10 is like bash script in Linux.

Basic Script

Edit file test1.bat, run this by .\test1.bat.


@ECHO OFF
ECHO This is the first script.
PAUSE
    

Ping Loop Script

pingLoop.bat script is defined as follows,


for %%i in (93,188) do (
    ping 192.168.1.%%i -w 10 -n 1 | find "Reply"
)
pause
    

Task Scheduler

  1. Open Task Scheduler in Search Bar of Windows 10.
  2. Select Create Basic Task from the Actions pane.
  3. Type Name and Description.
  4. Select Trigger option.
  5. Click on Start a Program.
  6. Browse your batch script.
  7. Finish.

References


  1. How can I ping a range of IP addresses simultaneously [closed]
  2. For loop in Windows 10
  3. What is Ping? with options
  4. How to schedule a Batch File to run automatically in Windows 10