Scheduled script to reset a modem

Posted on 2011-10-25
Last Modified: 2012-05-12

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
Question by:matmos
    LVL 12

    Accepted Solution

    @echo off
    echo ATH0 >COMx (where x is the assigned COM port number of your modem)

    Save your batch file, schedule through task manager

    Author Comment

    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 ?
    LVL 12

    Expert Comment

    by:Gary Coltharp
    LVL 43

    Assisted Solution

    by:Steve Knight
    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
    Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
    Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
    Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now