Jump to content

.bat Dosyası Ile Mümkün Olur Mu ?


Revenge
 Share

Recommended Posts

Merhaba arkadaşlar,

Services.msc'de ki hizmetleri cmd yada herhangi bir kod yardımıyla toplu olarak çalıştırabilir miyiz.

mesela x hizmeti elle olsun

            y hizmeti otomatik

            c hizmeti devre dışı olsun.

tek tıklamayla bunları bat ile toplayabilmek mümkün mü acaba ?

Yardım ve önerileriniz için şimdiden teşekkür ediyorum.

Edited by Revenge
Link to comment
Share on other sites

Tabii ki mümkündür. Bunun için kullancağın komutlar şöyle :
 
NET START "Messenger"
NET STOP "Messenger"

 

Yukarıda messenger servisini başlatan ve durduran komutları verdim. Daha fazlası için cmd ye "net" yazarsan daha neler yapacağını görebilirsin.

 

Bunların yanında windowsu kendi yazılımı da mevcut.

SC yani Servis Kontrol komutu ile de servis başlatıp durdurabilirsin.

 

Onunda parametreleri şöyle:

DESCRIPTION:
          SC is a command line program used for communicating with the
          NT Service Controller and services.
  USAGE:
      sc <server> [command] [service name]  ...

      The option <server> has the form "\\ServerName"
      Further help on commands can be obtained by typing: "sc [command]"
      Commands:
        query-----------Queries the status for a service, or
                        enumerates the status for types of services.
        queryex---------Queries the extended status for a service, or
                        enumerates the status for types of services.
        start-----------Starts a service.
        pause-----------Sends a PAUSE control request to a service.
        interrogate-----Sends an INTERROGATE control request to a service.
        continue--------Sends a CONTINUE control request to a service.
        stop------------Sends a STOP request to a service.
        config----------Changes the configuration of a service (persistant).
        description-----Changes the description of a service.
        failure---------Changes the actions taken by a service upon failure.
        qc--------------Queries the configuration information for a service.
        qdescription----Queries the description for a service.
        qfailure--------Queries the actions taken by a service upon failure.
        delete----------Deletes a service (from the registry).
        create----------Creates a service. (adds it to the registry).
        control---------Sends a control to a service.
        sdshow----------Displays a service's security descriptor.
        sdset-----------Sets a service's security descriptor.
        GetDisplayName--Gets the DisplayName for a service.
        GetKeyName------Gets the ServiceKeyName for a service.
        EnumDepend------Enumerates Service Dependencies.

      The following commands don't require a service name:
      sc <server> <command> <option>
        boot------------(ok | bad) Indicates whether the last boot should
                        be saved as the last-known-good boot configuration
        Lock------------Locks the Service Database
        QueryLock-------Queries the LockStatus for the SCManager Database
  EXAMPLE:
          sc start MyService
Link to comment
Share on other sites

SC komutu yeterli mesela yazıcı kullanmayanlar için yazıcı hizmetini durdurmak;

 

C:\Windows\system32>sc stop spooler
 
SERVICE_NAME: spooler
        TYPE               : 110  WIN32_OWN_PROCESS  (interactive)
        STATE              : 3  STOP_PENDING
                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0
 
başlatmak;
 
C:\Windows\system32>sc start spooler
 
SERVICE_NAME: spooler
        TYPE               : 110  WIN32_OWN_PROCESS  (interactive)
        STATE              : 2  START_PENDING
                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x7d0
        PID                : 2172
        FLAGS              :
 
Yazıcı hizmetini devre dışı bırakmak ;
 
C:\Windows\system32>sc config spooler start= disabled
[SC] ChangeServiceConfig SUCCESS
 
Yazıcı hizmetini otomatik başlatmak;
 
C:\Windows\system32>sc config spooler start= auto
[SC] ChangeServiceConfig SUCCESS
 
 
Not: CMD yönetici olarak açılmalıdır.
 
 
 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...