This works on Windows 10 Home.
- Open Notepad or any text editor
- Write the following code
- ping google.com
- pause
- You can use any domain name or IP address instead of ‘google.com’
- Save the file as filename.bat (replace filename with ‘ping’ or whatever you want)
- Right click on the file and select ‘Run as administrator’. If you don’t execute the file as administrator, it would run forever and you wont get any result.
You can avoid this last step, by following these next steps once.
- Right click on the file and select ‘Create shortcut’
- Right click on the shortcut and select ‘Properties’
- Click on ‘Shortcuts’ tab
- Click on ‘Advanced…’ button
- Tick mark ‘Run as administrator’
- Click OK.
- Now every time you double click shortcut, it will run as admin.
If you want to ping more than one domain, just add ‘ping’
- ping google.com
- ping bing.com
- pause
You can add pause in between pings if you want to see results.
Or you can make the code to write result into a file.
- ping google.com >> C:pingresult.txt
- ping bing.com >> C:pingresult.txt
No need of ‘pause’.
Change the folder path as you wish.
If you ping on a daily basis, this might be helpful;
- echo. >> C:pingresult.txt
- echo %DATE% %TIME% >> C:pingresult.txt
- ping google.com >> C:pingresult.txt
Every time you run the code, ping result would be added to the file ‘pingresult’ with date. First line adds a new line after the content already in the file.