batch file with a title?

H

Henry

Good day everyone. I have a question. I have a batch file
which I run regularly using Win scheduler. Now and then it
get itself in a twist and I have to kill it. I then have a
problem identifying which one to kill as I have multiple
cmd.exe running. How can I title or label my batch job so
that it is recognisable via task. I played around with
title but it doesn't suffice. Any suggestions?

Thanks
Henry
 
W

Walter Schulz

Good day everyone. I have a question. I have a batch file
which I run regularly using Win scheduler. Now and then it
get itself in a twist and I have to kill it. I then have a
problem identifying which one to kill as I have multiple
cmd.exe running. How can I title or label my batch job so
that it is recognisable via task. I played around with
title but it doesn't suffice. Any suggestions?

Batch with CMD extension?
copy %systemroot%\system32\cmd.exe twisted.exe

The task to run is called by
twisted.exe /c twisted.cmd

Ciao, Walter
 
P

Paul R. Sadowski

ps.exe from http://www.sysinternals.com shows the window title so you can
extract the pid for a given window title and kill it with your favorite
version of kill.

::suicide.cmd::
@echo off
setlocal enableextensions enabledelayedexpansion
set rnd=%RANDOM%
for /L %%x in (1,1,5) do set rnd=!rnd!!RANDOM!
title %rnd%
for /f "tokens=1-7*" %%c in ('ps.exe') do if %%h==%rnd% taskkill /PID %%d /F
 
M

Mark V

Paul R. Sadowski wrote in
ps.exe from http://www.sysinternals.com shows the window title so
you can extract the pid for a given window title and kill it with
your favorite version of kill.
[ ]

I wonder if you mean pslist.exe, which AFAIK does not show the window
Title. TLIST.EXE from the Resource Kit/ Support Tools can show
"title".
 
P

Paul R. Sadowski

Mark V said:
Paul R. Sadowski wrote in
ps.exe from http://www.sysinternals.com shows the window title so
you can extract the pid for a given window title and kill it with
your favorite version of kill.
[ ]

I wonder if you mean pslist.exe, which AFAIK does not show the window
Title. TLIST.EXE from the Resource Kit/ Support Tools can show
"title".

I just checked and I was mistaken. I do have a ps.exe but now I'm not sure
where it came from. When I did a strings against it I saw sysinternals but
it turns out that was a header for strings and not something within ps.exe.
The idea is the same, however.
 
T

Thanatos

PS.EXE is part of the POSIX commands that's included with Windows NT/2K/XP


Paul R. Sadowski said:
Mark V said:
Paul R. Sadowski wrote in
ps.exe from http://www.sysinternals.com shows the window title so
you can extract the pid for a given window title and kill it with
your favorite version of kill.
[ ]

I wonder if you mean pslist.exe, which AFAIK does not show the window
Title. TLIST.EXE from the Resource Kit/ Support Tools can show
"title".

I just checked and I was mistaken. I do have a ps.exe but now I'm not sure
where it came from. When I did a strings against it I saw sysinternals but
it turns out that was a header for strings and not something within ps.exe.
The idea is the same, however.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top