Internationalization of “sc” command












0















We have an application that parses the output of sc qdescription <service_name> to get the service description, and the usual output is something like:



C:>sc qdescription WSearch
[SC] QueryServiceConfig2 SUCCESS

SERVICE_NAME: WSearch
DESCRIPTION: Provides content indexing, property caching, and search results for files, e-mail, and other content.


However, we just discovered that depending on the OS language, the output can be different, e.g. in German:



C:>sc qdescription WSearch
[SC] QueryServiceConfig2 ERFOLG

SERVICE_NAME: WSearch
BESCHREIBUNG: Stellt Inhaltsindizierung und Eigenschaftenzwischenspeicherung und Suchergebnisse für Dateien, E-Mails und andere Inhalte bereit.


My question is:




  • Which criteria should be used to extract the description? The second occurrence of the text after the :?

  • What about other languages, e.g. Arabic or Chinese?










share|improve this question























  • There are other ways, see this Q&A Here a wmic query: wmic service where Name='WSearch' get name,caption,description /format:csv either parse the csv output directly or first save to a file.

    – LotPings
    Feb 28 at 15:19











  • @LotPings: thanks a lot, please post this as an answer

    – Ahmed Ashour
    Mar 4 at 10:13
















0















We have an application that parses the output of sc qdescription <service_name> to get the service description, and the usual output is something like:



C:>sc qdescription WSearch
[SC] QueryServiceConfig2 SUCCESS

SERVICE_NAME: WSearch
DESCRIPTION: Provides content indexing, property caching, and search results for files, e-mail, and other content.


However, we just discovered that depending on the OS language, the output can be different, e.g. in German:



C:>sc qdescription WSearch
[SC] QueryServiceConfig2 ERFOLG

SERVICE_NAME: WSearch
BESCHREIBUNG: Stellt Inhaltsindizierung und Eigenschaftenzwischenspeicherung und Suchergebnisse für Dateien, E-Mails und andere Inhalte bereit.


My question is:




  • Which criteria should be used to extract the description? The second occurrence of the text after the :?

  • What about other languages, e.g. Arabic or Chinese?










share|improve this question























  • There are other ways, see this Q&A Here a wmic query: wmic service where Name='WSearch' get name,caption,description /format:csv either parse the csv output directly or first save to a file.

    – LotPings
    Feb 28 at 15:19











  • @LotPings: thanks a lot, please post this as an answer

    – Ahmed Ashour
    Mar 4 at 10:13














0












0








0








We have an application that parses the output of sc qdescription <service_name> to get the service description, and the usual output is something like:



C:>sc qdescription WSearch
[SC] QueryServiceConfig2 SUCCESS

SERVICE_NAME: WSearch
DESCRIPTION: Provides content indexing, property caching, and search results for files, e-mail, and other content.


However, we just discovered that depending on the OS language, the output can be different, e.g. in German:



C:>sc qdescription WSearch
[SC] QueryServiceConfig2 ERFOLG

SERVICE_NAME: WSearch
BESCHREIBUNG: Stellt Inhaltsindizierung und Eigenschaftenzwischenspeicherung und Suchergebnisse für Dateien, E-Mails und andere Inhalte bereit.


My question is:




  • Which criteria should be used to extract the description? The second occurrence of the text after the :?

  • What about other languages, e.g. Arabic or Chinese?










share|improve this question














We have an application that parses the output of sc qdescription <service_name> to get the service description, and the usual output is something like:



C:>sc qdescription WSearch
[SC] QueryServiceConfig2 SUCCESS

SERVICE_NAME: WSearch
DESCRIPTION: Provides content indexing, property caching, and search results for files, e-mail, and other content.


However, we just discovered that depending on the OS language, the output can be different, e.g. in German:



C:>sc qdescription WSearch
[SC] QueryServiceConfig2 ERFOLG

SERVICE_NAME: WSearch
BESCHREIBUNG: Stellt Inhaltsindizierung und Eigenschaftenzwischenspeicherung und Suchergebnisse für Dateien, E-Mails und andere Inhalte bereit.


My question is:




  • Which criteria should be used to extract the description? The second occurrence of the text after the :?

  • What about other languages, e.g. Arabic or Chinese?







windows






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 28 at 13:43









Ahmed AshourAhmed Ashour

1,3872716




1,3872716













  • There are other ways, see this Q&A Here a wmic query: wmic service where Name='WSearch' get name,caption,description /format:csv either parse the csv output directly or first save to a file.

    – LotPings
    Feb 28 at 15:19











  • @LotPings: thanks a lot, please post this as an answer

    – Ahmed Ashour
    Mar 4 at 10:13



















  • There are other ways, see this Q&A Here a wmic query: wmic service where Name='WSearch' get name,caption,description /format:csv either parse the csv output directly or first save to a file.

    – LotPings
    Feb 28 at 15:19











  • @LotPings: thanks a lot, please post this as an answer

    – Ahmed Ashour
    Mar 4 at 10:13

















There are other ways, see this Q&A Here a wmic query: wmic service where Name='WSearch' get name,caption,description /format:csv either parse the csv output directly or first save to a file.

– LotPings
Feb 28 at 15:19





There are other ways, see this Q&A Here a wmic query: wmic service where Name='WSearch' get name,caption,description /format:csv either parse the csv output directly or first save to a file.

– LotPings
Feb 28 at 15:19













@LotPings: thanks a lot, please post this as an answer

– Ahmed Ashour
Mar 4 at 10:13





@LotPings: thanks a lot, please post this as an answer

– Ahmed Ashour
Mar 4 at 10:13










1 Answer
1






active

oldest

votes


















1














As mentioned in my comment, there are other ways.



Using Service Wuauserv instead of Wsearch



A wmic query with output formatted as csv has the disadvantage that the values are NOT double quoted, so parsing get's difficult when the description also contains commas.



wmic service where Name='Wuauserv' get name,caption,description /format:csv


The object oriented powershell doesn't have this problem:



(Get-Wmiobject win32_service | Where Name -eq 'Wuauserv').Description


The same wrapped into a batch file:



@Echo off
for /F "usebackq delims=" %%A in (`
powershell -NoP -C "(get-wmiobject win32_service|Where Name -eq 'Wuauserv').Description"
`) do set "Description=%%A"
set Description


Sample output (German locale)




>set Description

Description=Erkennung, Herunterladen und Installation von Updates für Windows und andere Programme. Wenn der Dienst deaktiviert ist, können "Windows Update" bzw. das Feature "automatische Updates" nicht verwendet werden. Außerdem können Programme
dann die Windows Update Agent-Programmierschnittstelle (WUA API) nicht verwenden.







share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1410200%2finternationalization-of-sc-command%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    As mentioned in my comment, there are other ways.



    Using Service Wuauserv instead of Wsearch



    A wmic query with output formatted as csv has the disadvantage that the values are NOT double quoted, so parsing get's difficult when the description also contains commas.



    wmic service where Name='Wuauserv' get name,caption,description /format:csv


    The object oriented powershell doesn't have this problem:



    (Get-Wmiobject win32_service | Where Name -eq 'Wuauserv').Description


    The same wrapped into a batch file:



    @Echo off
    for /F "usebackq delims=" %%A in (`
    powershell -NoP -C "(get-wmiobject win32_service|Where Name -eq 'Wuauserv').Description"
    `) do set "Description=%%A"
    set Description


    Sample output (German locale)




    >set Description

    Description=Erkennung, Herunterladen und Installation von Updates für Windows und andere Programme. Wenn der Dienst deaktiviert ist, können "Windows Update" bzw. das Feature "automatische Updates" nicht verwendet werden. Außerdem können Programme
    dann die Windows Update Agent-Programmierschnittstelle (WUA API) nicht verwenden.







    share|improve this answer




























      1














      As mentioned in my comment, there are other ways.



      Using Service Wuauserv instead of Wsearch



      A wmic query with output formatted as csv has the disadvantage that the values are NOT double quoted, so parsing get's difficult when the description also contains commas.



      wmic service where Name='Wuauserv' get name,caption,description /format:csv


      The object oriented powershell doesn't have this problem:



      (Get-Wmiobject win32_service | Where Name -eq 'Wuauserv').Description


      The same wrapped into a batch file:



      @Echo off
      for /F "usebackq delims=" %%A in (`
      powershell -NoP -C "(get-wmiobject win32_service|Where Name -eq 'Wuauserv').Description"
      `) do set "Description=%%A"
      set Description


      Sample output (German locale)




      >set Description

      Description=Erkennung, Herunterladen und Installation von Updates für Windows und andere Programme. Wenn der Dienst deaktiviert ist, können "Windows Update" bzw. das Feature "automatische Updates" nicht verwendet werden. Außerdem können Programme
      dann die Windows Update Agent-Programmierschnittstelle (WUA API) nicht verwenden.







      share|improve this answer


























        1












        1








        1







        As mentioned in my comment, there are other ways.



        Using Service Wuauserv instead of Wsearch



        A wmic query with output formatted as csv has the disadvantage that the values are NOT double quoted, so parsing get's difficult when the description also contains commas.



        wmic service where Name='Wuauserv' get name,caption,description /format:csv


        The object oriented powershell doesn't have this problem:



        (Get-Wmiobject win32_service | Where Name -eq 'Wuauserv').Description


        The same wrapped into a batch file:



        @Echo off
        for /F "usebackq delims=" %%A in (`
        powershell -NoP -C "(get-wmiobject win32_service|Where Name -eq 'Wuauserv').Description"
        `) do set "Description=%%A"
        set Description


        Sample output (German locale)




        >set Description

        Description=Erkennung, Herunterladen und Installation von Updates für Windows und andere Programme. Wenn der Dienst deaktiviert ist, können "Windows Update" bzw. das Feature "automatische Updates" nicht verwendet werden. Außerdem können Programme
        dann die Windows Update Agent-Programmierschnittstelle (WUA API) nicht verwenden.







        share|improve this answer













        As mentioned in my comment, there are other ways.



        Using Service Wuauserv instead of Wsearch



        A wmic query with output formatted as csv has the disadvantage that the values are NOT double quoted, so parsing get's difficult when the description also contains commas.



        wmic service where Name='Wuauserv' get name,caption,description /format:csv


        The object oriented powershell doesn't have this problem:



        (Get-Wmiobject win32_service | Where Name -eq 'Wuauserv').Description


        The same wrapped into a batch file:



        @Echo off
        for /F "usebackq delims=" %%A in (`
        powershell -NoP -C "(get-wmiobject win32_service|Where Name -eq 'Wuauserv').Description"
        `) do set "Description=%%A"
        set Description


        Sample output (German locale)




        >set Description

        Description=Erkennung, Herunterladen und Installation von Updates für Windows und andere Programme. Wenn der Dienst deaktiviert ist, können "Windows Update" bzw. das Feature "automatische Updates" nicht verwendet werden. Außerdem können Programme
        dann die Windows Update Agent-Programmierschnittstelle (WUA API) nicht verwenden.








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 5 at 10:57









        LotPingsLotPings

        5,2351823




        5,2351823






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1410200%2finternationalization-of-sc-command%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How do I know what Microsoft account the skydrive app is syncing to?

            When does type information flow backwards in C++?

            Grease: Live!