Scheduled script to reset a modem


We have an analog modem in a Win7 PC that is used to dial out . Occasionally the modem hangs and leaves the telephone line open.

Is it possible to write a script or batch file that could be run as a scheduled task every 15 minutes to restart the modem (ie dropping the line and then having the modem ready for use again). Realise that occasionally it may interrupt a job in use but dont mind that.

If so any help please with the content of the script ?

thank you
Who is Participating?
Gary ColtharpSr. Systems EngineerCommented:
@echo off
echo ATH0 >COMx (where x is the assigned COM port number of your modem)

Save your batch file, schedule through task manager
matmosAuthor Commented:
Thank you for quick response.

I get access is denied when trying this command manually from a DOS prompt (I guess as another application is using the modem - hence why it has opened the line).

Perhaps would be better to kill the application ?
Gary ColtharpSr. Systems EngineerCommented:
Steve KnightIT ConsultancyCommented:
Hmm even if you could get  simple com port redirect to talk to the COM port like this from Win 7... I imagine it would have to "run as administrator" for starters, though don't think it would work anyway!

I suppose tests to do would be :

1. Install a terminal emulator that can talk to com port, e.g. Hyperterminal, haven't looked on my Win7 here yet if that is still around as an option.  If so see if the port is available, i.e. try a terminal session to com1 and see if you get any reponse from it.  In which case try the ath0 and see if that hangs up.

Meanwhile while in this state see if end tasking the application in task manager also kills the line.  If so then you could easily do a:

taskkill /FI "IMAGENAME eq whatever.exe"
taskkill /IM whatever.exe

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.