How to check if a wired connection is present in a batch file?
Posted: 28 Mar 2023 04:50
I'm running the following batch file when logging in:
This worked as intended on my previous laptop, but it always seems to jump to 'ItIsntHere' when ran at login on this laptop. If I run the batch file manually it's working as intended, it just isn't working properly at login. I've tried added delays and that hasn't made a difference.
I think the next step would be instead of checking for my NAS, checking if an ethernet connection is present or not - how would I set up a check for this?
Cheers!
Code: Select all
::if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
:: See if NAS is connected locally
Dir \\192.168.0.26\Docker\CheckFile.txt
If %ErrorLevel% EQU 0 GoTo FileSpecifiedIsHere
GoTo ItIsntHere
Pause This line is never reached
:FileSpecifiedIsHere
::Do whatever I want to if the one specified is detected
Start "Starting the application" /MIN "C:\Program Files (x86)\Razer\Synapse3\WPFUI\Framework\Razer Synapse 3 Host\Razer Synapse 3.exe
GoTo EndThisBatch
:ItIsntHere
::Do whatever I want to if the one specified is not detected
Start "Starting the application" /MIN "C:\Program Files (x86)\ASUSTOR\EZ Connect\EasyConnect.exe"
GoTo EndThisBatch
:EndThisBatch
I think the next step would be instead of checking for my NAS, checking if an ethernet connection is present or not - how would I set up a check for this?
Cheers!