@echo off tasklist /nh > 1.txt sort < 1.txt pause 

I need to leave only the name and memory occupied by the processors so that the sorting is by name, and where is the same name by memory.

  • Find for Windows and use cut - remove sections on each line of files - avp
  • @avp, then sed is better - greg zakharov
  • @gregzakharov, why? cut -b -5,11- file.txt flying solves the problem - avp
  • @ avp does not work '@echo off tasklist> pr.txt cut -b -25,63- pr.txt sort <pr.txt start pr.txt pause' - ZhoskiY
  • @ZhoskiY, in * nix-ah cut prints (like most commands) its result in stdout (and does not edit the file (I think it works the same in Windows)) Try tasklist | cut -b -25,63- | sort >pr.txt tasklist | cut -b -25,63- | sort >pr.txt tasklist | cut -b -25,63- | sort >pr.txt - avp

1 answer 1

 @echo off tasklist /nh >list.txt setlocal enableextensions enabledelayedexpansion ( for /f "skip=2 tokens=1,2,3*" %%a in (list.txt) do ( set "A=%%a set B=%%d echo !A:~0,30!!B:~1,15! ) ) > t2.txt sort t2.txt > t3.txt endlocal start t3.txt