Network connectiviy test batch file

June 17, 2009 at 08:50:38
Specs: Windows XP
I am trying to making a batch file that needs to check for network connectivity. If there is a reply then do one thing (copy some files), if there is no reply then do something else (start a .exe)...

I can do the easy bits, copying and starting programs etc but have no idea about the network test. I am guessing that I need to use the IF statement but I have never used this before. Can anybody help out?

This is my current code. I basically want to run this if there is network connectivity but if there is no network connectivity then to only run the .exe

@echo off
del "C:\Program Files\FlightDeck" /f /q
mkdir "C:\Program Files\FlightDeck"
xcopy "H:\computers\share\program installs\FlightDeck" "C:\Program Files\FlightDeck" /e /q /c
cd "C:\Program Files\FlightDeck"
start AqualisaDashboard.exe
:end

Thanks!


See More: Network connectiviy test batch file

Report •


#1
June 17, 2009 at 16:40:11
It's all good I figured it out, works like a dream!! Code bellow for future reference:

::Flight Deck/Aqualisa Dash Board Start up

@echo off

if exist "\\aq-fs\fileshare_data\computers\share\Program Installs\FlightDeck\AqualisaDashboard.exe" goto :online
goto :offline

:online
del "%Programfiles%\FlightDeck" /q /f
mkdir "%Programfiles%\FlightDeck"
xcopy "\\aq-fs\fileshare_data\computers\share\Program Installs\FlightDeck" "C:\Program Files\FlightDeck" /e /q /c
cd "%Programfiles%\FlightDeck"
start AqualisaDashboard.exe
goto :end

:offline
cd "%Programfiles%\FlightDeck"
start AqualisaDashboard.exe
goto :end

:end
exit


Report •
Related Solutions


Ask Question