PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.win.server.scripting > how can i create a Batch file to kill some processes by name
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
how can i create a Batch file to kill some processes by name

Réponse
 
LinkBack Outils de la discussion
Vieux 23/09/2008, 19h21   #1
Hansel Ortiz -[BrEcHaWarr]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut how can i create a Batch file to kill some processes by name

hi guys... i`ll be searching in the web trying to find a script to
kill one or various process, but i just can find
how to kill process by pid.

how can i to this.... just searching the name process like Starting
with X.... or task%..
something like that.. if someone could ..

i couldn`t find the sintax of the taskkill to refer this command to a
name.. just pid and others...


thanks
  Réponse avec citation
Vieux 23/09/2008, 19h57   #2
Pegasus \(MVP\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how can i create a Batch file to kill some processes by name


"Hansel Ortiz -[BrEcHaWarr]" <hansel.ortiz@gmail.com> wrote in message
news:2018fa9c-896b-459e-9953-f9f09bc00850@f63g2000hsf.googlegroups.com...
> hi guys... i`ll be searching in the web trying to find a script to
> kill one or various process, but i just can find
> how to kill process by pid.
>
> how can i to this.... just searching the name process like Starting
> with X.... or task%..
> something like that.. if someone could ..
>
> i couldn`t find the sintax of the taskkill to refer this command to a
> name.. just pid and others...
>
>
> thanks


Type taskkill /? at the Command Prompt to get the full for this command
(and, for that, for any other console command!).


  Réponse avec citation
Vieux 23/09/2008, 22h45   #3
Hansel Ortiz -[BrEcHaWarr]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how can i create a Batch file to kill some processes by name

On Sep 23, 1:57pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:
> "Hansel Ortiz -[BrEcHaWarr]" <hansel.or...@gmail.com> wrote in messagenews:2018fa9c-896b-459e-9953-f9f09bc00850@f63g2000hsf.googlegroups.com...
>
> > hi guys... i`ll be searching in the web trying to find a script to
> > kill one or various process, but i just can find
> > how to kill process by pid.

>
> > how can i to this.... just searching the name process like Starting
> > with X.... or task%..
> > something like that.. if someone could ..

>
> > i couldn`t find the sintax of the taskkill to refer this command to a
> > name.. just pid and others...

>
> > thanks

>
> Type taskkill /? at the Command Prompt to get the full for this command
> (and, for that, for any other console command!).


well.. i just need the reference to search a process for name, i used
taskkill /? and i dont know wich one to use :S


i Try this batch file version. but trying to change the syntax of
the "notepad.exe"
for examble --->>> "Note%" all processes that start with 'note'

@echo off
set prev=
FOR /F "tokens=2" %%i IN ('tasklist ^| Find /i "notepad.EXE"') DO CALL
:windowlist %%i
goto :EOF

:windowlist
if not "%prev%"=="" echo TASKKILL /PID %prev% /F
set prev=%1
  Réponse avec citation
Vieux 24/09/2008, 00h03   #4
Pegasus \(MVP\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how can i create a Batch file to kill some processes by name


"Hansel Ortiz -[BrEcHaWarr]" <hansel.ortiz@gmail.com> wrote in message
news:1b5ca0fe-2938-4b58-8f73-4354f0b74ac2@z72g2000hsb.googlegroups.com...
On Sep 23, 1:57 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:
> "Hansel Ortiz -[BrEcHaWarr]" <hansel.or...@gmail.com> wrote in
> messagenews:2018fa9c-896b-459e-9953-f9f09bc00850@f63g2000hsf.googlegroups.com...
>
> > hi guys... i`ll be searching in the web trying to find a script to
> > kill one or various process, but i just can find
> > how to kill process by pid.

>
> > how can i to this.... just searching the name process like Starting
> > with X.... or task%..
> > something like that.. if someone could ..

>
> > i couldn`t find the sintax of the taskkill to refer this command to a
> > name.. just pid and others...

>
> > thanks

>
> Type taskkill /? at the Command Prompt to get the full for this
> command
> (and, for that, for any other console command!).


well.. i just need the reference to search a process for name, i used
taskkill /? and i dont know wich one to use :S


i Try this batch file version. but trying to change the syntax of
the "notepad.exe"
for examble --->>> "Note%" all processes that start with 'note'

@echo off
set prev=
FOR /F "tokens=2" %%i IN ('tasklist ^| Find /i "notepad.EXE"') DO CALL
:windowlist %%i
goto :EOF

:windowlist
if not "%prev%"=="" echo TASKKILL /PID %prev% /F
set prev=%1

================

The batch file you quote does something quite different from what you want:
It kills every "notepad" process except for the last one in the list. If you
want to kill all processes whose names contain the word "note" then you can
do it much more simply:

@echo off
setlocal EnableDelayedExpansion
set PIDs=
for /F "tokens=2" %%a in ('tasklist ^| find "note"') do set PIDs=!PIDs! /pid
%%a
echo TaskKill %PIDs% /F /T

Remove the word "echo" in the last line to activate the batch file.


  Réponse avec citation
Vieux 01/10/2008, 06h02   #5
Andrew Mishechkin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how can i create a Batch file to kill some processes by name

Here my cmd-file: pskill.cmd
-------------
@ECHO OFF
REM Using this bat-file: pskill ProcessName [RemoteComputerName] [UserName]
[UserPassword]
IF "%1"=="" (GOTO Error)
IF "%2"=="" (SET NodeName=.) ELSE (SET NodeName=%2)
IF NOT "%3"=="" (GOTO AnotherUser)
wmic /NODE:%NodeName% PROCESS WHERE (name="%1") CALL TERMINATE
GOTO End

:AnotherUser
SET UserName=%3
IF NOT "%4"=="" (SET Password=%4) ELSE (SET Password="")
wmic /NODE:%NodeName% /User:%UserName% /Password:%Password% PROCESS WHERE
(name="%1") CALL TERMINATE
GOTO End

:Error
ECHO Using this bat-file: pskill ProcessName [RemoteComputerName] [UserName]
[UserPassword]

:End
------------------
With best regards
Andrew Mishechkin

"Hansel Ortiz -[BrEcHaWarr]" <hansel.ortiz@gmail.com> Ñообщил/Ñообщила в
новоÑÑ‚ÑÑ… Ñледующее:
news:2018fa9c-896b-459e-9953-f9f09bc00850@f63g2000hsf.googlegroups.com...
> hi guys... i`ll be searching in the web trying to find a script to
> kill one or various process, but i just can find
> how to kill process by pid.
>
> how can i to this.... just searching the name process like Starting
> with X.... or task%..
> something like that.. if someone could ..
>
> i couldn`t find the sintax of the taskkill to refer this command to a
> name.. just pid and others...
>
>
> thanks


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h05.


Édité par : vBulletin® version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14967 seconds with 13 queries