How to stop running a scheduled batch file?

Posted on 2006-04-26
Last Modified: 2013-12-28
In Windows Task scheduler a batch file is scheduled to run everyday at 6am. The first day the job ran successfully (which kicked off some other processes) in < one minute. However the second day the status shows "running" persistently and the jobs that supposed to be kicked off by the batch file never got kicked off.

The batch job is scheduled to run every day at 6am. It's now after 12 noon and it is sitll "running". I tried to add an "exit" line at the end but it didn't work. Is there anything that I am missing?

The batch file is as follows:

DEL C:\AT_Batch\at_spool.txt
sqlplus pinprd/pintst_pin05@xm_pintst  @"C:\AT_Batch\at_sql.sql"

Question by:HKBoyz
    LVL 7

    Assisted Solution


    I would add the word CALL in front of this line: sqlplus pinprd/pintst_pin05@xm_pintst  @"C:\AT_Batch\at_sql.sql" so that a response is returned to the batch file so that it can close out.

    Author Comment

    I did try that but got the result (ie. status keeps "running" forever).

    Author Comment

    I mean I got the same result with "CALL".
    LVL 43

    Assisted Solution

    by:Steve Knight
    Is the SQLPLUS process still running ... check task manager process list and kill it.

    at the end of the batch file.

    Author Comment

    did try both and got the same result. This may not be the problem of the batch file. I have "exit" in the batch file and i could see the dos window pop uo when batch file is being executed. When finished the dos window goes away, but the batch status is still "running".

    Would it be the Windows Task Scheduler which keeps the batch file running?
    LVL 4

    Assisted Solution

    perhaps the batchfile stops at the line where the file is deleted because it is asking for confirmation but you cannot see it ;
    the first time went ok because the file did not exist (just guessing)
    Try adding /Y after the delete command to avoid confirmation dialog
    LVL 43

    Accepted Solution

    So is the SQLPLUS process till running or not?  Perhaps Task Scheduler sees that a 'child' process is still running?
    What happens when you launch it manually?

    Author Comment

    Added "Exit" at the end of the SQL file (not the batch file) and it takes care of it. Once the SQL was executed the batch file also stopped running.
    Thanks everyone.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    To find the source of an account lockout, look in the local Event Viewer>Security, and look at the Failure Audits, for any that match either SYSTEM, or the UserID in question. If you find any, open the log entry, and you will see a Logon Type entr…
    Several part series to implement Internet Explorer 11 Enterprise Mode
    This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
    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…

    759 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

    13 Experts available now in Live!

    Get 1:1 Help Now