d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Paying Fg For A Batch File > Details Inside .. Nothing Hazardous
12Next
Closed New Topic New Poll
Member
Posts: 15,338
Joined: Sep 17 2011
Gold: 34.88
Oct 25 2013 07:00pm
i want to be able to click this file and leave it open forever

now heres what i need it to do .. if any program hangs for more then 30 seconds i want it to kill it

kinda like this but i want it to do it without me having to click y to close it ..



@echo off
tasklist /fi "status eq not responding"
echo .
set /p ans=kill these tasks? (Type Y to kill tasks)
if %ans%==Y goto kill
goto eof
:kill
taskkill /f /fi "status eq not responding"

You have to type a capital Y, the lower case will bail without killing the tasks, as will any other response besides Y


found that on google but im not finding what i need

someone wanna build me something or send me in the right direction?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Oct 25 2013 07:26pm
i dont get it. if you just want to remove the prompt, can't you just remove the prompt?

@echo off
tasklist /fi "status eq not responding"
echo .
--remove the following lines
--set /p ans=kill these tasks? (Type Y to kill tasks)
--if %ans%==Y goto kill
--goto eof

:kill
taskkill /f /fi "status eq not responding"

not sure how that detects if it's "hanging" though, but i'm not a batch expert.

This post was edited by carteblanche on Oct 25 2013 07:27pm
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Oct 25 2013 08:00pm
does it need to be a batch file?
Member
Posts: 15,338
Joined: Sep 17 2011
Gold: 34.88
Oct 25 2013 08:02pm
well im not sure if it neeeeeeds to be .. if you can make a simple program to do the same



so heres the story .. i run automation on a game i play and every once and a while i get the white screen of doom .. it freezes

so im hoping to find a solution to this by having either a program or a batch to watch the programs and if it stall to simply close it
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Oct 25 2013 08:24pm
Quote (frankbrown1193 @ Oct 25 2013 10:02pm)
well im not sure if it neeeeeeds to be .. if you can make a simple program to do the same



so heres the story .. i run automation on a game i play and every once and a while i get the white screen of doom .. it freezes

so im hoping to find a solution to this by having either a program or a batch to watch the programs and if it stall to simply close it


if the computer freezes then running a program to close it isnt gonna do shit. if the program itself is frozen, then just ctrl + alt + del. i'm not clear how you would determine whether an abtritrary program is stalling as opposed to just running. but i've never tried looking.
Member
Posts: 15,338
Joined: Sep 17 2011
Gold: 34.88
Oct 25 2013 08:43pm
Quote (carteblanche @ 25 Oct 2013 21:24)
if the computer freezes then running a program to close it isnt gonna do shit. if the program itself is frozen, then just ctrl + alt + del. i'm not clear how you would determine whether an abtritrary program is stalling as opposed to just running. but i've never tried looking.


my computer is fine it never freezes .. just looking for a way to have something monitor and kill any tasks that aretn responsive
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Oct 25 2013 08:52pm
Code
import psutil
import time

list_of_dead_pids=[]
while True:
time.sleep(30)
list_of_pids = psutil.get_pid_list()
for pid in list_of_pids:
test_process = psutil.Process(pid)
try:
if test_process.status != "running":
if pid in list_of_dead_pids:
test_process.kill()
list_of_dead_pids.pop(list_of_dead_pids.index(pid))
else:
list_of_dead_pids.append(pid)
except:
pass


In python. It seems to work, but I don't have any way to really test it... hehe anyone know a good way to make a process stop responding? lol
Member
Posts: 15,338
Joined: Sep 17 2011
Gold: 34.88
Oct 25 2013 08:54pm
uuuggh i dont know much about python .. so you would have to explain how to implement this
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Oct 25 2013 09:03pm
Quote (frankbrown1193 @ Oct 25 2013 07:54pm)
uuuggh i dont know much about python .. so you would have to explain how to implement this


Well if you wanted to actually implement it in this form, you would need to install a python interpreter (Windows x86 MSI Installer (2.7.5)), and a few other things, that would probably not be worth it, if you aren't interested in writing python scripts. But it could be packaged into a redistributable for you. The problem is, it is not tested, because I don't know how to test it (I don't know how to make an application stop responding to ensure this actually works!).

So if anyone knows a good way to test it, hehe I'd like to hear it.

This post was edited by Azrad on Oct 25 2013 09:04pm
Member
Posts: 15,338
Joined: Sep 17 2011
Gold: 34.88
Oct 25 2013 09:08pm
delete your windows media player library and dump 500 + gigs of music into it @ once
Go Back To Programming & Development Topic List
12Next
Closed New Topic New Poll