2

I'm making a batch program for launching OS's and utilities, one of these utilities needs to list the currently open applications/windows like task manager but its only apps no BGPROS.

here's a image to show what i need

enter image description here

heres the file

https://drive.google.com/open?id=0Bz92BbPiREo9MHYybTBaNEcyak0

and here's the code so you can find the where it is.

:TASKCHK
cls
:: THIS IS WHERE THE APP LISTER GOES!
echo.
pause
goto UTIL
  • 2
    Please note Stack Overflow isn't a free code writing service, please add you current script or effort on trying to solve the issue. –  Sep 29 '17 at 23:37
  • And just some hints: `TASKLIST`. The `EQ`/`NE` operator can be used to filter the Apps and background processes. –  Sep 29 '17 at 23:39
  • Please add code as MCVE. (Minimal, Complete, and Verifiable example). See https://stackoverflow.com/help/mcve for more info. –  Sep 29 '17 at 23:53
  • When you say no background processes what do you mean? Generally a process which requires no interaction is considered to be a background process, for that reason it usually runs invisibly in the UI. I would suggest that you would need to write a utility program for this kind of thing, certainly not rely on Windows built-in executables running from a batch file. For that reason I do not believe that the batch-file tag is relevant for your question at this point in time, but feel free to post your batch file to show me I'm wrong, I'd be interested in seeing it. – Compo Sep 30 '17 at 00:15
  • i could show you a picture but i need more rep – Don 2theMAX Miller Sep 30 '17 at 00:17
  • I don't want a picture, copy and paste the batch script code which you've created to list foreground processes only. Provide with it an explanation of where you're having problems with it or which parts of it your experiencing trouble with. – Compo Sep 30 '17 at 00:26
  • Of those four items, one of them is a bootstrapper, a bootstrapper is responsible for the initialization of applications and does so non interactively. As such I would consider it a background process. That said, can you provide me with the batch code which attempts to list only those four items? – Compo Sep 30 '17 at 00:53
  • I might be able to if i can find the code for task manager then put that on my program – Don 2theMAX Miller Oct 02 '17 at 22:14
  • i might be able to filter certain processes through the tasklist command and add stuff to it in the future, luckily its an OS launcher so it should be small. – Don 2theMAX Miller Oct 02 '17 at 22:25
  • i checked the code for task manager and its all dll's so ill have to make it myself. – Don 2theMAX Miller Oct 02 '17 at 22:26

1 Answers1

0

if you use the /nh parameter after the first command, you can have multiple imagename filters and it lists all the specified processes under one header but it leaves a gap. this is what it would look like:

tasklist /fi "imagename eq cmd.exe"
tasklist /nh /fi "imagename eq Taskmgr.exe"
tasklist /nh /fi "imagename eq chrome.exe"
tasklist /nh /fi "imagename eq Steam.exe"
tasklist /nh /fi "imagename eq explorer.exe"
tasklist /nh /fi "imagename eq wmplayer.exe"

just add another tasklist command to add a new process. And now you can create a batch task manager that, sort of, lists only applications.