hi guys. i seem to be having a problem using ms dos. now manually i know how to connect to a network and upload files onto a server. im struggling to create a shell script that will automatically detect when an internet connection is present and then connect to it. how could i do this? please help!!

thank you guys :)

Why doesn't it connect automatically anyway? Do you need to enter user/passwd or some other info? Or are you using JUST DOS rather than a shell under Windows? Using Windows, my computer would connect as soon as it discovered that the internet was present, so it'll be kind of difficult to give you anything without more info.

Besides, you're not likely to get a lot of help here as most of the posts in this forum pertain to Linux/Unix type shells rather than MS-DOS. I recently switched to Linux as Windows Defender AND McAfee couldn't stop some nasty trojans and they altered critical system files so that I can never get rid of it. I got tired of playing that game and haven't seen even a warning of viruses or other bad software that some idiot wrote to annoy everyone in the world!

Update: I just thought of something. Where you wrote "..automatically detect when an internet connection is present..", did you actually mean "..automatically detect when a network connection is present.."?

Edited 6 Years Ago by gwmorris: n/a

Something like this?

@setlocal enableextensions enabledelayedexpansion
@echo off
set ipaddr=%1
:loop
set state=down
for /f "tokens=5,7" %%a in ('ping -n 1 !ipaddr!') do (
    if "x%%a"=="xReceived" if "x%%b"=="x1," set state=up
)
echo.Link is !state!
ping -n 6 127.0.0.1 >nul: 2>nul:
goto :loop
endlocal
This article has been dead for over six months. Start a new discussion instead.