IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Discussion :

(MS DOS) Tester les services


Sujet :

Windows

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Inactif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 054
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 054
    Par défaut (MS DOS) Tester les services
    Bonjour à tous

    Je recherche une commande DOS qui permette de tester un service pour savoir s’il est activer ou désactiver.

    Quelqu’un saurait-il m’aider ?

  2. #2
    SLE
    SLE est déconnecté
    Membre émérite Avatar de SLE
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Janvier 2004
    Messages
    604
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : Belgique

    Informations professionnelles :
    Activité : Consultant informatique

    Informations forums :
    Inscription : Janvier 2004
    Messages : 604
    Par défaut
    salut,

    Essaie avec la commande SC.

    http://www.microsoft.com/resources/d.../ntcmds_o.mspx

    @+

  3. #3
    Inactif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 054
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 054
    Par défaut
    Bonjour SLE et merci pour se lien

    Mais se site est en anglai et le traducteur de google n’arrive pas à le traduire.

  4. #4
    Expert éminent


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Par défaut
    as tu effectuer une recherche de la commande SC dans l'aide en ligne de windows ...?

    que veu-tu faire exactement ?

  5. #5
    Inactif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 054
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 054
    Par défaut
    Bonjour bbil

    Oui j’ai taper « sc / ? », il y a bien l’aide mais elle est aussi en anglai.

    Ben enfaîte je voudrai tester un service pour voir s’il est activer ou désactiver.

  6. #6
    Expert éminent


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Par défaut
    Citation Envoyé par Furius
    Bonjour bbil

    Oui j’ai taper « sc / ? », il y a bien l’aide mais elle est aussi en anglai.

    Ben enfaîte je voudrai tester un service pour voir s’il est activer ou désactiver.
    pour l'aide en français ... moi je l'ai dans menu démarrer "Aide et support"...

    sinon tu peu faire
    pour connaître l'état du service "NomService" ... si tu connais pas le nom exact de ton service utilise
    et fais défiler les pages (touche entrée) jusqu'a afficher ton service ... (tu pourra noter le nom ...)


  7. #7
    Inactif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 054
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 054
    Par défaut
    Merci bbil
    Fonctionne bien mais encore le résultat est en anglais :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    SERVICE_NAME: helpsvc
            TYPE               : 20  WIN32_SHARE_PROCESS
            STATE              : 1  STOPPED
                                    (NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
            WIN32_EXIT_CODE    : 1077       (0x435)
            SERVICE_EXIT_CODE  : 0  (0x0)
            CHECKPOINT         : 0x0
            WAIT_HINT          : 0x0
    En faite si je veut tester se service s’est pour rediriger vers une étiquette Goto selon si le service est activer ou désactiver.
    S’il est activer le script se redirigera vers l’étiquette Goto sous la quel se trouvera le code pour désactiver se service, sinon fin du script.

    Sauriez vous m’aider ?

  8. #8
    Expert éminent


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Par défaut
    le test ne semble pas faciel à faire dans un '.bat'... mais si de toute façon c'est pour arrêter le service utilise :

    sans aucun test préalable ...

    et pour éviter l'affichage de message d'erreur utilise


  9. #9
    Inactif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 054
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 054
    Par défaut
    Merci beaucoup bill

    Mon problème est résolu.

  10. #10
    Expert confirmé
    Avatar de le y@m's
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2005
    Messages
    2 636
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Février 2005
    Messages : 2 636
    Par défaut
    avec un bat :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    sc query helpsvc | findstr "STATE" | findstr "RUNNING"
    if %ERRORLEVEL%==0 goto desactiveservice
    Je ne répondrai à aucune question technique par MP.

    Pensez aux Tutoriels et aux FAQs avant de poster ;) (pour le java il y a aussi JavaSearch), n'oubliez pas non plus la fonction Rechercher.
    Enfin, quand une solution a été trouvée à votre problème
    pensez au tag :resolu:

    Cours Dvp : http://ydisanto.developpez.com
    Blog : http://yann-disanto.blogspot.com/
    Page perso : http://yann-disanto.fr

  11. #11
    Inactif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 054
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 054
    Par défaut
    Bonjour le y@m's et merci beaucoup

  12. #12
    Rédacteur


    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    7 171
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 7 171
    Billets dans le blog
    1
    Par défaut
    au cas où :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    echo off
     rem Get_Srvc_Status.cmd
     rem affiche le status d'un service
     
     rem %1 nom du service à interroger
    if %1'==' goto SyntaxeError
    if "%TEMP%"=="" goto Error2
    
    set Service_Status=
    
    rem Interroge le service contenu dans la variable %1
    "SC.EXE" interrogate %1>"%TEMP%\FileWORK.TMP"
    
    rem le mot clé "STATE" est présent si et seulement si le service est démarré et running
    rem il peut être démarré et pending
    
    rem le service est dans un certain état :
    rem état possible d'un service ( MS-SDK  02/03 )
    rem "Stopped"
    rem "Start Pending"
    rem "Stop Pending"
    rem "Running"
    rem "Continue Pending"
    rem "Pause Pending"
    rem "Paused"
    rem "Unknown"
    
    :notExist
    rem le service n'existe pas.
    type "%TEMP%\FileWORK.TMP"|find /i "FAILED 1060:">nul
    rem 1 non la chaine n'existe pas.
    rem 0 oui la chaine existe.
    IF ERRORLEVEL 1 goto Running
    IF ERRORLEVEL 0 set Service_Status=NOTEXIST&Echo NOT Exist   : %1&goto FIN
    
    :Running
    type "%TEMP%\FileWORK.TMP"|find /i "STATE              : 4  RUNNING">nul
    IF ERRORLEVEL 1 set Service_Status=NOTRUNNING&goto notRunning
    IF ERRORLEVEL 0 set Service_Status=RUNNING&Echo     Running : %1 &goto fin
    
    :notRunning
    rem le service est à l'état arreté.
    type "%TEMP%\FileWORK.TMP"|find /i "FAILED 1062:">nul
    IF ERRORLEVEL 1 set Service_Status=UNKNOW&goto unknow1
    IF ERRORLEVEL 0 set Service_Status=NOTRUNNING&Echo NOT Running : %1&goto fin
    
    :Unknow1
    rem le service ne peut être interrogé
    type "%TEMP%\FileWORK.TMP"|find /i "FAILED 1061:">nul
    IF ERRORLEVEL 1 set Service_Status=UNKNOW&goto unknow2
    IF ERRORLEVEL 0 set Service_Status=UNKNOW&Echo     Unknown : %1  * Reinterroger plus tard &goto fin
    
    :Unknow2
    Echo     Pending : %1 
    type "%TEMP%\FileWORK.TMP"|find /i "STATE"
    goto fin
    
    :SyntaxeError
    Echo.
    Echo Erreur : 
    Echo Il manque un parametre.
    Echo %0 NOM_SERVICE
    Echo.
    Pause
    Goto fin
    
    :Error2
    Echo.
    Echo Erreur : 
    Echo La variable d'environnement TEMP n'existe pas.
    Echo La déclarer dans la partie environnement SYSTEM ou USER
    Echo.
    Pause
    Goto fin
    
    :fin

  13. #13
    Inactif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 054
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 054
    Par défaut
    Bonjour Laurent Dardenne et merci

  14. #14
    SLE
    SLE est déconnecté
    Membre émérite Avatar de SLE
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Janvier 2004
    Messages
    604
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : Belgique

    Informations professionnelles :
    Activité : Consultant informatique

    Informations forums :
    Inscription : Janvier 2004
    Messages : 604
    Par défaut
    Salut,

    Si tu veux simplement arrêter le service, tu peux faire un simple


  15. #15
    Inactif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 054
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 054
    Par défaut
    Bonjour et merci SLE

    Oui je conait cette commande, il me falait carrement désactiver le service,se qui et fait, merci à vous.

  16. #16
    Membre confirmé
    Inscrit en
    Mai 2006
    Messages
    100
    Détails du profil
    Informations forums :
    Inscription : Mai 2006
    Messages : 100
    Par défaut
    Tu peux aussi utiliser "net start" qui liste les services lancés sur ta machine.

    Si le service est coupé en deux, il faut que tu le mette entre guillemets, genre:
    "Network Associates Task Manager"

  17. #17
    Rédacteur


    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    7 171
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 7 171
    Billets dans le blog
    1
    Par défaut
    salut,
    il faut utiliser le nom indiqué dans Service Name (cf. sc query)
    SERVICE_NAME: Spooler
    DISPLAY_NAME: Print Spooler
    C:\Temp>SC.EXE interrogate "Print Spooler"
    [SC] OpenService FAILED 1060:

    Le service spécifié n'existe pas en tant que service installé.


    C:\Temp>SC.EXE interrogate "Spooler"

    SERVICE_NAME: Spooler
    TYPE : 110 WIN32_OWN_PROCESS (interactive)
    STATE : 4 RUNNING
    (STOPPABLE,NOT_PAUSABLE,ACCEPTS_SHUTDOWN)
    WIN32_EXIT_CODE : 0 (0x0)
    SERVICE_EXIT_CODE : 0 (0x0)
    CHECKPOINT : 0x0
    WAIT_HINT : 0x0

    C:\Temp>
    cf. http://delphi.developpez.com/faq/?pa...enirnomservice

  18. #18
    Inactif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 054
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 054
    Par défaut
    Rebonjour

    le y@m's >>>>>

    Sauriez vous tester un processus avec « PSKill » ?

  19. #19
    Expert confirmé
    Avatar de le y@m's
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2005
    Messages
    2 636
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Février 2005
    Messages : 2 636
    Par défaut
    Citation Envoyé par Furius
    « PSKill »
    c'est pas une commande windows ça.

    Si tu parle de l'utilitaire de Sysinternals :
    usage: pskill [-?] [-t] [\\computer [-u username] [-p password]] <process name | process id>

    -?
    Displays the supported options.
    -t
    Kill the process and its descendants.
    \\computer
    Specifies the computer on which the process you want to terminate is executing. The remote computer must be accessible via the NT network neighborhood.
    -u username
    If you want to kill a process on a remote system and the account you are executing in does not have administrative privileges on the remote system then you must login as an administrator using this command-line option. If you do not include the password with the -p option then PsKill will prompt you for the password without echoing your input to the display.
    -p password
    This option lets you specify the login password on the command line so that you can use PsList from batch files. If you specify an account name and omit the -p option PsList prompts you interactively for a password.
    process id
    Specifies the process ID of the process you want to kill.
    process name
    Specifies the process name of the process or processes you want to kill.
    Peut-être que l'utilitaire psList te sera plus interessant
    usage: pslist [-?] [-d] [-m] [-x][-t][-s [n] [-r n]][\\computer [-u username] [-p password]] [name | pid]

    -?
    Displays the supported options and the units of measurement used for output values.
    -d
    This switch has PsList show statistics for all active threads on the system, grouping threads with their owning process.
    -m
    This switch has PsList show memory-oriented information for each process, rather than the default of CPU-oriented information.
    -x
    With this switch PsList shows CPU, memory and thread information for each of the processes specified.
    -t
    Shows the tree of processes.
    -s [n]
    Has PsList run in task-manager-like updating mode. You can optionally specify the number of seconds it runs and abort it by pressing the escape key.
    -r n

    Task-manager mode refresh rate in seconds (default is 1).
    name
    Instead of listing all the running processes in the system, this parameter narrows PsList's scan to those processes that begin with the name process. Thus:
    pslist exp
    would statistics for all the processes that start with "exp", which would include Explorer.
    -u
    username If you want to kill a process on a remote system and the account you are executing in does not have administrative privileges on the remote system then you must login as an administrator using this command-line option. If you do not include the password with the -p option then PsList will prompt you for the password without echoing your input to the display.
    -p
    password This option lets you specify the login password on the command line so that you can use PsList from batch files. If you specify an account name and omit the -p option PsList prompts you interactively for a password.
    \\computer
    Instead of showing process information for the local system, PsList will show information for the NT/Win2K system specified. Include the -u switch with a username and password to login to the remote system if your security credentials do not permit you to obtain performance counter information from the remote system.
    pid
    Instead of listing all the running processes in the system, this parameter narrows PsList's scan to tthe process that has the specified PID. Thus:
    pslist 53
    would dump statistics for the process with the PID 53.
    Je ne l'ai pas testé.
    Je ne répondrai à aucune question technique par MP.

    Pensez aux Tutoriels et aux FAQs avant de poster ;) (pour le java il y a aussi JavaSearch), n'oubliez pas non plus la fonction Rechercher.
    Enfin, quand une solution a été trouvée à votre problème
    pensez au tag :resolu:

    Cours Dvp : http://ydisanto.developpez.com
    Blog : http://yann-disanto.blogspot.com/
    Page perso : http://yann-disanto.fr

  20. #20
    Inactif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 054
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 054
    Par défaut
    Bonjour le y@m's et merci beaucoup

    « PSKill » je crois que je l’ai télécharger quelque par mais je ne sais plus ou.

    Je viens donc de télécharger « pslist », ici :
    http://www.sysinternals.com/utilities/pslist.html

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Réponses: 2
    Dernier message: 27/01/2015, 16h29
  2. Livre : XML et les services Web
    Par cyberzoide dans le forum XML/XSL et SOAP
    Réponses: 1
    Dernier message: 27/05/2007, 17h12
  3. [VB.NET] afficher les "Services" de mon serv
    Par sangokus dans le forum ASP.NET
    Réponses: 3
    Dernier message: 05/03/2004, 13h09
  4. ADO et les service
    Par titanblanc dans le forum Bases de données
    Réponses: 2
    Dernier message: 04/03/2004, 09h23

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo