Question Locked

How to automate tasklist?

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Every once in awhile I like to run the tasklist and get an output file.

Can I automate this and place it in my Administrator folder?

Here is what currently do.
Run
Cmd
tasklist /svc >"h:\my Documents\ed\tasklist_01.doc"
exit

This produces a document which shows all my current processes.

I have tried writing a batch program to run this but I just can not make it work.

Can anyone tell me how I do this?

4 replies

by sbrown95

Try something like this:

:::::Begin file::::::::::
@echo off
h:
cd\
cd "h:\my documents\ed\"
tasklist /svc >"h:\my documents\ed\tasklist_01.doc"
::::End File:::::

It's really simple, but it should work. Just cut and paste the above into a txt and rename with a .cmd extension.

by jenueheightz

Ok I did what you suggested. However it gives the same result as my previous attempts.

Here is what is gives instead of the proper information. As you can see it is not a list from taskliskt.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

H:\My Documents\Ed>

What happens is one command opens then a second one.
The first window has the following in it

'Run' is not recognized as an internal or external command,
operable program or batch file.

Now the second window has

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

H:\My Documents\Ed>

Which is copied to the tasklist_01.doc

Yes it seems like it should be easy but I just do not understand what I am missing. It seems like just never see the command tasklist.

Just figured out what the problem what the problem.

I needed to write it as tasklist.exe not just tasklist.

Tasklist will work in
Run
cmd
tasklist /svc >"h:\my documents\ed\tasklist_0r.doc"

However it must have the extension exe to run from a program.

Thank for your reply

by locolobo

I took sbrown95's text and changed it to

c:
cd\
tasklist /svc >"c:\temp\tasklist_01.txt"

saved that as "tasklist.bat", then added it to my scheduled tasks folder. It worked. Cool! For some reason with the @echo off command it wasn't working. It would create an empty file.

This discussion is closed to new replies.