Funciones de Comprobaciones

Iniciado por ANTRAX, Julio 18, 2011, 09:35:37 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Funcion, averiguar si un servicio esta corriendo:

Código: dos
:: Autor ne0x
:: Sintaxis:

:: call:svc nombre variable
:: nombre Nombre del servicio a chequear
:: variable Nombre de la variable en la que se pondra la respuesta en dato boleano

:svc
net start | find "%~1" > nul
if %errorlevel%==0 (
set %2=0
  ) ELSE (
set %2=1
)
goto:EOF


Funcion, averiguar si se ha iniciado un proceso:

Código: dos

:: Autor ne0x
:: Sintaxis

:: call:pr nombre variable
:: nombre Nombre del proceso a chequear
:: variable Nombre de la variable en la que se guardara la respuesta en tipo boleano.

:pr
taskklist | find "%~1"
if %errorlevel%==0 (
set %2=0
  ) ELSE (
set %2=1
)
goto:EOF