1.

Solve : command or Program that can terminate an application after specified time?

Answer»

Greeting,
I am looking for a command or a program that can terminate an application after a specified time. Say, I want to run a certain Application for 12 hrs and I want to end it after 12hrs is passed and start another application.
any help is appreciated/Vansky03Code: [Select]@echo off
set time=43200
:loop
cls
IF %time% GTR 0 (
set /a time=%time% - 1
echo %time%
ping 127.0.0.1 -n 2 > NUL
goto loop
)
start cmd.exe
pause
this will run cmd after 12 hours (43200 seconds)
hmm i smell a virus...vansky03 do you intend to use this for malicious purposes?Try setting up two batch files.

The FIRST will put the SECOND on the scheduler to run in 12 hours (at command). It will also launch your first program.

The second will contain a taskkill command to kill off the first program and then launch the second program.

Batch code does not do date/time arithmetic very well, however with 12 hours you should only need to flip the am/pm indicator and determine if the new time is tomorrow.

Good LUCK.


Quote from: macdad- on July 05, 2008, 06:33:30 PM

hmm i smell a virus...vansky03 do you intend to use this for malicious purposes?

How so? With all the accusations of VIRUSES and homework, it's a wonder anyone is willing to post a question.the title says "command or Program that can terminate an application after specified time". "terminate" MEAINING delete

Quote
ter�mi�nate �audio� (t�rm-nt) KEY �

VERB:
ter�mi�nat�ed , ter�mi�nat�ing , ter�mi�nates
VERB:
tr.

1. To bring to an end or halt: "His action terminated the most hopeful period of reform in Prussian history" (Gordon A. Craig).
2. To occur at or form the end of; conclude or finish: a display of fireworks that terminated the festivities.
3. To discontinue the employment of; dismiss: a company that terminated 300 workers.

VERB:
intr.

1. To come to an end: The oil pipeline terminates at a shipping port. Negotiations terminated yesterday. See Synonyms at complete.
2. To have as an end or result: "The Peloponnesian war ... terminated in the ruin of the Athenian commonwealth" (Alexander Hamilton).


Quote
the title says "command or Program that can terminate an application after specified time". "terminate" meaining delete

Taskkill can terminate a program. It can delete a program from memory, not from disk. Del can delete a program from disk, not from memory.

Why are you assuming the worst about the posters? Your nomination to the CH Welcome Wagon may be in serious jeopardy.

im sorry sidewinder.
i guess that i was jumpy.
but vansky is gone...
and he didnt thank you nor jacob.Greeting,
Did not mean to be ungrateful to you all, just did not have a chance to try the codes until today and it's worked great.
Thank you all/Vansky.
PS. no I am not using the program as a virus or malicious purpose.ok. i apollogize vanksy for any assumptions i made about you using this for malcious purposes.Not a problem Macdad,
I guess the Title does suggest so, what I really mean is to end the current running app after 12hrs then start another.
peace..


Discussion

No Comment Found