Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Network connectivy test batch file

Status
Not open for further replies.

k3lvin

Technical User
Jan 13, 2008
143
0
0
GB
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 and run a .exe), if there is no reply then do something else (skip the file copy and just run the .exe)

I can do the easy bits, copying and starting .exe 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 (last 3 lines of the code)

@echo off
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
:end

Thanks!
 
It's ok I figured it out. Code bellow for other people who need to do similar tasks:

::Flight Deck/Aqualisa Dash Board Start up

@echo off

if exist "\\aq-fs\fileshare_data\computers\share\Program Installs\FlightDeck\AqualisaDashboard.exe" goto :eek:nline
goto :eek:ffline

:eek:nline
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

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

:end
exit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top