title: How to loop through tasks in Windows cmd and only output task if it is NOT in a list?
body: <p>I am trying to output unneeded tasks to the Windows command line. The end result should be that I basically kill all unneeded tasks with the click of a button. But to avoid any problems I am outputting the tasks names for now. I know there is other ways like disabling them on <code>msconfig</code> or <code>regedit</code>, but for now this is what I want.</p>
  
  <p>The problem is I have been away from console usage for a long time and it has left me slightly confused. I have code below that outputs all running tasks, but it doesn't stop outputting the tasks in the <code>mylist</code> array. I think the problem is my nested <code>for</code> loop, but I don't know any other ways of passing the two arrays to one list so that I can check them. Any help would be greatly appreciated.</p>
  
  <pre><code>@echo off
  set mylist=csrss.exe, dwm.exe, System, smss.exe Rem&lt;&lt;List
  for /f "tokens=1" %%a in ('tasklist') do ( Rem&lt;&lt;This returns process name
      for %%b in ('%mylist%') do ( Rem&lt;&lt;b is MEANT to be each process in list
          if not %%a == %%b ( Rem&lt;&lt;If anything in tasklist is in mylist, don't include it
              echo %%a) Rem&lt;&lt;Output processes NOT in mylist.
      )
  )
  pause
  </code></pre>