Windows Batch Script to Put Ping Output in a Text File
In DOS, OS/2, and also Microsoft Windows, batch file is the name given to a type of script file, a text file containing a series of commands to be executed by the command interpreter. A batch file may contain any command the interpreter accepts interactively at the command prompt. A batch file may also have constructs (IF, GOTO, Labels, CALL, etc.) that enable conditional branching and looping within the batch file. Recently i was playing with it and got a cool script while playing with ping command which will output ping results in a text file in Desktop.
I have been using that batch file to get DigitalOceans and Vultrs all location to get ping result from my network. It helps to take decision which location will be better.
Digitaloceans All locations test ip’s:
NYC1: 198.211.112.36 NYC2: 162.243.123.82 AMS1: 146.185.176.179 AMS2: 95.85.7.154 SFO1: 162.243.146.51 SGP1: 128.199.236.18 LON1: 178.62.63.247 SGP1: 2400:6180::d0:0:0:1:5001 LON1: 2a03:b0c0:1:d0::6001
Batch File to generate a text file by the ping test of above ipv4 addresses.
@echo off cd echo Batch file created by Fahad Ahammed (www.obakfahad.com) >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo Digitalocean NYC1 echo Digitalocean NYC1 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" ping 198.211.112.36 ping 198.211.112.36 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo Digitalocean NYC2 echo Digitalocean NYC2 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" ping 162.243.123.82 ping 162.243.123.82 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo Digitalocean AMS1 echo Digitalocean AMS1 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" ping 146.185.176.179 ping 146.185.176.179 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo Digitalocean AMS2 echo Digitalocean AMS2 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" ping 95.85.7.154 ping 95.85.7.154 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo Digitalocean SFO1 echo Digitalocean SFO1 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" ping 162.243.146.51 ping 162.243.146.51 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo Digitalocean SGP1 echo Digitalocean SGP1 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" ping 128.199.236.18 ping 128.199.236.18 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo Digitalocean LON1 echo Digitalocean LON1 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" ping 178.62.63.247 ping 178.62.63.247 >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopdigitalocean_ping_from_yournetwork.txt" pause
You can download already created batch file from here.You can just double click to get the result in a text file in your desktop.
Vultrs batch file for ping test:
@echo off cd echo Batch file created by Fahad Ahammed (www.obakfahad.com) >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ________________ASIA PACIFIC___________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo (Asia) Tokyo, Japan echo (Asia) Tokyo, Japan >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping hnd-jp-ping.vultr.com ping hnd-jp-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo (AU) Sydney, Australia echo (AU) Sydney, Australia >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping syd-au-ping.vultr.com ping syd-au-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ________________EUROPE___________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo (EU) Frankfurt, DE echo (EU) Frankfurt, DE >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping fra-de-ping.vultr.com ping fra-de-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo (EU) Amsterdam, NL echo (EU) Amsterdam, NL >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping ams-nl-ping.vultr.com ping ams-nl-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo (EU) Paris, France echo (EU) Paris, France >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping par-fr-ping.vultr.com ping par-fr-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo (EU) London, UK echo (EU) London, UK >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping lon-gb-ping.vultr.com ping lon-gb-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ________________NORTH AMERICA___________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo Seattle, Washington echo Seattle, Washington >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping wa-us-ping.vultr.com ping wa-us-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo New York / New Jersey echo New York / New Jersey >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping nj-us-ping.vultr.com ping nj-us-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo Chicago, Illinois echo Chicago, Illinois >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping il-us-ping.vultr.com ping il-us-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo Los Angeles, California echo Los Angeles, California >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping lax-ca-us-ping.vultr.com ping lax-ca-us-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo Atlanta, Georgia echo Atlanta, Georgia >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping ga-us-ping.vultr.com ping ga-us-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo Dallas, Texas echo Dallas, Texas >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping tx-us-ping.vultr.com ping tx-us-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo Miami, Florida echo Miami, Florida >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ___________________________________ echo ___________________________________ >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" ping fl-us-ping.vultr.com ping fl-us-ping.vultr.com >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" echo ################################### echo ################################### >> "C:Users%username%Desktopvultr_ping_from_yournetwork.txt" pause
Vultrs Batch file to ping test. Pelase leave feedback.