DosTips.com

A Forum all about DOS Batch
It is currently 22 Nov 2017 12:42

All times are UTC-06:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 01 Dec 2014 10:53 
Offline

Joined: 01 Dec 2014 07:22
Posts: 2
I had a service. I want to know whether the service had been installed on the system or not. I can provide some part of the service name but not entirely.
I have tried couple of commands but couldn't get the result.

sc query
find


Last edited by sujitha on 01 Dec 2014 11:33, edited 1 time in total.

Top
   
PostPosted: 01 Dec 2014 11:08 
Offline
Expert

Joined: 23 Dec 2011 13:59
Posts: 3626
Find all services that begin with the letter W
Code: Select all
T:\>sc query | findstr /I /B /R /C:"^SERVICE_NAME: W.*"
SERVICE_NAME: W32Time
SERVICE_NAME: wcncsvc
SERVICE_NAME: WdiServiceHost
SERVICE_NAME: wdPostMan
SERVICE_NAME: WebClient
SERVICE_NAME: Winmgmt
SERVICE_NAME: Wlansvc
SERVICE_NAME: wmiApSrv
SERVICE_NAME: wscsvc
SERVICE_NAME: WSearch
SERVICE_NAME: wuauserv
SERVICE_NAME: wudfsvc


Top
   
PostPosted: 01 Dec 2014 11:10 
Offline

Joined: 01 Dec 2014 07:22
Posts: 2
I guess this commands only gets the services which are active or in started mode.


Top
   
PostPosted: 01 Dec 2014 11:28 
Offline
Expert

Joined: 23 Dec 2011 13:59
Posts: 3626
IF you READ the HELP file for the SC command you would see this.
Code: Select all
QUERY and QUERYEX OPTIONS:
        If the query command is followed by a service name, the status
        for that service is returned.  Further options do not apply in
        this case.  If the query command is followed by nothing or one of
        the options listed below, the services are enumerated.
    type=    Type of services to enumerate (driver, service, all)
             (default = service)
    state=   State of services to enumerate (inactive, all)
             (default = active)
    bufsize= The size (in bytes) of the enumeration buffer
             (default = 4096)
    ri=      The resume index number at which to begin the enumeration
             (default = 0)
    group=   Service group to enumerate
             (default = all groups)

SYNTAX EXAMPLES
sc query                - Enumerates status for active services & drivers
sc query eventlog       - Displays status for the eventlog service
sc queryex eventlog     - Displays extended status for the eventlog service
sc query type= driver   - Enumerates only active drivers
sc query type= service  - Enumerates only Win32 services
sc query state= all     - Enumerates all services & drivers
sc query bufsize= 50    - Enumerates with a 50 byte buffer
sc query ri= 14         - Enumerates with resume index = 14
sc queryex group= ""    - Enumerates active services not in a group
sc query type= interact - Enumerates all interactive services
sc query type= driver group= NDIS     - Enumerates all NDIS drivers



Code: Select all
sc query type= all state= all | findstr /I /B /R /C:"^SERVICE_NAME: W.*"


Top
   
PostPosted: 01 Dec 2014 16:19 
Offline
Expert

Joined: 10 Feb 2012 02:20
Posts: 6033
sujitha wrote:
I had a service. I want to know whether the service had been installed on the system or not.


When you say installed, that implies it is currently running right?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: Google [Bot] and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited