tasklist en Batch se pone en bucle sin motivo alguno [AYUDA]


Dark

🔥root313🔥
Staff
Moderador
Paladín de Nodo
Jinete de Nodo
Burgués de Nodo
Noderador
Nodero
Noder Pro
Noder
Seré breve:


Alguien sabe porque coño pasa esto?

El documento de texto solo pone "tasklist"

He probado con muchos otros comandos a ver si pasa lo mismo pero obviamente no, nunca me ha pasado esto haciendo scripts de Batch.

(Estaba intentando hacer un "programa" que salga la lista de tareas por orden de uso de memoria y que se refresque y movidas, solo por probar algo)
 

Sadsu

後輩
Noderador
Nodero
Noder
prueba asi:
TASKLIST
pause


si quieres para ver procesos de mas de por ejemplo 3000 kb va asi:
tasklist /fi "memusage gt 3000"
pause


y si quieres hacer un bucle del comando te dejo este comando para que se ejecute las veces que quieras para actualizar los procesos

@echo off
set loopcount=1000
:loop
tasklist
pause
set /a loopcount=loopcount-1
if %loopcount%==0 goto exitloop
goto loop
:exitloop
pause

si le das a enter se actualizan los procesos en loopcount puedes poner las veces que quieres darle a enter para que se actualice asi, si le das 1000 veces a enter se cerrara. puedes cambiar el numero en set loopcount=x
te dejo las opciones que te deja tasklist.

Get the list of process using memory space greater than certain value.​

tasklist /fi "memusage gt memorysize"
Memory size should be specified in KB
For example, to get the list of processes occupying more than 30MB of memory, we can run the below command.

tasklist /fi "memusage gt 30000"

Find the list of processes launched by a user​

tasklist /fi "username eq userName"
Find the memory usage of a specific process


tasklist /fi "pid eq processId"
Example:

c:\>tasklist /fi "pid eq 6544"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
WmiPrvSE.exe 6544 Services 0 8,936 K
Find the list of not responding processes

tasklist /fi "status eq not responding"
example:

c:\>tasklist /fi "status eq not responding"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
rundll32.exe 3916 Console 1 7,028 K
Get the list of services running in a process

tasklist /svc /fi "pid eq processId"
Example:

c:\>tasklist /svc /fi "pid eq 624"
Image Name PID Services
========================= ======== ============================================
lsass.exe 624 EFS, KeyIso, Netlogon, ProtectedStorage,
SamSs, VaultSvc
c:\>
Get list of processes running for more than certain time

tasklist /fi "cputime gt hh:mm:ss"
example:
Get the list of processes that have been running from more than an hour and 20 minutes.

c:\>tasklist /fi "cputime gt 01:20:00"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 24 K
SynTPEnh.exe 4152 Console 1 8,080 K
firefox.exe 1740 Console 1 857,536 K
c:\>
Find processes that are running a specified image file:

tasklist /fi "imagename eq imageName"
Example:

c:\>tasklist /fi "imagename eq firefox.exe"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
firefox.exe 1740 Console 1 812,160 K
c:\>
Find the process running a specific service

tasklist /fi "services eq serviceName"
example:

c:\>tasklist /fi "services eq webclient"

Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
svchost.exe 1052 Services 0 20,204 K
c:\>
 
Última edición:
  • Like
Reacciones : Dark

Dark

🔥root313🔥
Staff
Moderador
Paladín de Nodo
Jinete de Nodo
Burgués de Nodo
Noderador
Nodero
Noder Pro
Noder
prueba asi:
TASKLIST
pause


si quieres para ver procesos de mas de por ejemplo 3000 kb va asi:
tasklist /fi "memusage gt 3000"
pause


y si quieres hacer un bucle del comando te dejo este comando para que se ejecute las veces que quieras para actualizar los procesos

@echo off
set loopcount=1000
:loop
tasklist
pause
set /a loopcount=loopcount-1
if %loopcount%==0 goto exitloop
goto loop
:exitloop
pause

si le das a enter se actualizan los procesos en loopcount puedes poner las veces que quieres darle a enter para que se actualice asi, si le das 1000 veces a enter se cerrara. puedes cambiar el numero en set loopcount=x
te dejo las opciones que te deja tasklist.

Get the list of process using memory space greater than certain value.​

tasklist /fi "memusage gt memorysize"
Memory size should be specified in KB
For example, to get the list of processes occupying more than 30MB of memory, we can run the below command.

tasklist /fi "memusage gt 30000"

Find the list of processes launched by a user​

tasklist /fi "username eq userName"
Find the memory usage of a specific process


tasklist /fi "pid eq processId"
Example:

c:\>tasklist /fi "pid eq 6544"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
WmiPrvSE.exe 6544 Services 0 8,936 K
Find the list of not responding processes

tasklist /fi "status eq not responding"
example:

c:\>tasklist /fi "status eq not responding"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
rundll32.exe 3916 Console 1 7,028 K
Get the list of services running in a process

tasklist /svc /fi "pid eq processId"
Example:

c:\>tasklist /svc /fi "pid eq 624"
Image Name PID Services
========================= ======== ============================================
lsass.exe 624 EFS, KeyIso, Netlogon, ProtectedStorage,
SamSs, VaultSvc
c:\>
Get list of processes running for more than certain time

tasklist /fi "cputime gt hh:mm:ss"
example:
Get the list of processes that have been running from more than an hour and 20 minutes.

c:\>tasklist /fi "cputime gt 01:20:00"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 24 K
SynTPEnh.exe 4152 Console 1 8,080 K
firefox.exe 1740 Console 1 857,536 K
c:\>
Find processes that are running a specified image file:

tasklist /fi "imagename eq imageName"
Example:

c:\>tasklist /fi "imagename eq firefox.exe"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
firefox.exe 1740 Console 1 812,160 K
c:\>
Find the process running a specific service

tasklist /fi "services eq serviceName"
example:

c:\>tasklist /fi "services eq webclient"

Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
svchost.exe 1052 Services 0 20,204 K
c:\>
Si ya estuve viendo parametros y eso, el problema era eso, que se ejecutaba muuuuchas veces y supongo que por eso no me llegaba a ejecutar vien el tasklist (con parametros), tipo, no salía el output del comando. Luego probaré todo esto a ver.
 

Sadsu

後輩
Noderador
Nodero
Noder
Si ya estuve viendo parametros y eso, el problema era eso, que se ejecutaba muuuuchas veces y supongo que por eso no me llegaba a ejecutar vien el tasklist (con parametros), tipo, no salía el output del comando. Luego probaré todo esto a ver.
yo lo ejecute tal cual y se me cerraba el cmd por eso puse un pause para que no cerrara solo pero me parecia incomodo que no se pueda actualizar por eso busque tambien para hacer un loop y probe todo y va de lujo
 
  • Like
Reacciones : Dark