Just change 'hosttocheck' to whatever your NAS IP is.
Save it as 'waitfornetwork.bat' and CALL it from another batch file, etc. as needed.
Code:
@ECHO OFF
SET hosttocheck=192.168.0.33
:waitfornetwork
PING -n 1 -w 1000 %hosttocheck% >netcheck.txt
FINDSTR /C:"Packets: Sent = 1, Received = 0, Lost = 1" netcheck.txt >NUL 2>NUL
IF %ERRORLEVEL% == 0 (
GOTO waitfornetwork
)
FINDSTR /C:"Request timed out." netcheck.txt >NUL 2>NUL
IF %ERRORLEVEL% == 0 (
GOTO waitfornetwork
)
FINDSTR /C:"Destination host unreachable." netcheck.txt >NUL 2>NUL
IF %ERRORLEVEL% == 0 (
GOTO waitfornetwork
)
DEL netcheck.txt
SET hosttocheck=