Focusing a window in cmd with Nircmd












0















First time posting. I have been playing around with creating macros that can individually adjust the sound of individual application. Found that Nircmd has the commands that I want for example if I wanted to increase the volume of Example.exe by 20% I can use a batch file that says:



Nircmd.exe changeappvolume Example.exe .2



I have tested this and it works great for changing an app I know I will be using in the background, however I would also like to change the volume of the window that I have open as my focused applications are often games or a variety of other apps. My plan is to bind these batch file to a set of hot keys that run them in the back ground but I would rather not have to write a Macro set for every single primary program.



In theory Nircmd.exe should be able to change the volume of the 'focused window' using:



Nircmd.exe changeappvolume focused .2


however I am having trouble figuring out how to focus the window of an that I am actively using.










share|improve this question























  • "Focus" is a concept of the OS, not Nircmd. A focused window is the active window, the one currently accepting user input, the highlighted one. If you are actively using a window, it is focused. If you are actively using one window, all other windows are NOT focused. So, what is not working? According to the Nircmd reference, you're already using the correct syntax. Please edit your question to clarify the actual problem or what you are trying to accomplish.

    – music2myear
    Sep 6 '18 at 18:04
















0















First time posting. I have been playing around with creating macros that can individually adjust the sound of individual application. Found that Nircmd has the commands that I want for example if I wanted to increase the volume of Example.exe by 20% I can use a batch file that says:



Nircmd.exe changeappvolume Example.exe .2



I have tested this and it works great for changing an app I know I will be using in the background, however I would also like to change the volume of the window that I have open as my focused applications are often games or a variety of other apps. My plan is to bind these batch file to a set of hot keys that run them in the back ground but I would rather not have to write a Macro set for every single primary program.



In theory Nircmd.exe should be able to change the volume of the 'focused window' using:



Nircmd.exe changeappvolume focused .2


however I am having trouble figuring out how to focus the window of an that I am actively using.










share|improve this question























  • "Focus" is a concept of the OS, not Nircmd. A focused window is the active window, the one currently accepting user input, the highlighted one. If you are actively using a window, it is focused. If you are actively using one window, all other windows are NOT focused. So, what is not working? According to the Nircmd reference, you're already using the correct syntax. Please edit your question to clarify the actual problem or what you are trying to accomplish.

    – music2myear
    Sep 6 '18 at 18:04














0












0








0








First time posting. I have been playing around with creating macros that can individually adjust the sound of individual application. Found that Nircmd has the commands that I want for example if I wanted to increase the volume of Example.exe by 20% I can use a batch file that says:



Nircmd.exe changeappvolume Example.exe .2



I have tested this and it works great for changing an app I know I will be using in the background, however I would also like to change the volume of the window that I have open as my focused applications are often games or a variety of other apps. My plan is to bind these batch file to a set of hot keys that run them in the back ground but I would rather not have to write a Macro set for every single primary program.



In theory Nircmd.exe should be able to change the volume of the 'focused window' using:



Nircmd.exe changeappvolume focused .2


however I am having trouble figuring out how to focus the window of an that I am actively using.










share|improve this question














First time posting. I have been playing around with creating macros that can individually adjust the sound of individual application. Found that Nircmd has the commands that I want for example if I wanted to increase the volume of Example.exe by 20% I can use a batch file that says:



Nircmd.exe changeappvolume Example.exe .2



I have tested this and it works great for changing an app I know I will be using in the background, however I would also like to change the volume of the window that I have open as my focused applications are often games or a variety of other apps. My plan is to bind these batch file to a set of hot keys that run them in the back ground but I would rather not have to write a Macro set for every single primary program.



In theory Nircmd.exe should be able to change the volume of the 'focused window' using:



Nircmd.exe changeappvolume focused .2


however I am having trouble figuring out how to focus the window of an that I am actively using.







command-line audio cmd.exe macros nircmd






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 5 '18 at 2:26









Anthony CardinaliAnthony Cardinali

1




1













  • "Focus" is a concept of the OS, not Nircmd. A focused window is the active window, the one currently accepting user input, the highlighted one. If you are actively using a window, it is focused. If you are actively using one window, all other windows are NOT focused. So, what is not working? According to the Nircmd reference, you're already using the correct syntax. Please edit your question to clarify the actual problem or what you are trying to accomplish.

    – music2myear
    Sep 6 '18 at 18:04



















  • "Focus" is a concept of the OS, not Nircmd. A focused window is the active window, the one currently accepting user input, the highlighted one. If you are actively using a window, it is focused. If you are actively using one window, all other windows are NOT focused. So, what is not working? According to the Nircmd reference, you're already using the correct syntax. Please edit your question to clarify the actual problem or what you are trying to accomplish.

    – music2myear
    Sep 6 '18 at 18:04

















"Focus" is a concept of the OS, not Nircmd. A focused window is the active window, the one currently accepting user input, the highlighted one. If you are actively using a window, it is focused. If you are actively using one window, all other windows are NOT focused. So, what is not working? According to the Nircmd reference, you're already using the correct syntax. Please edit your question to clarify the actual problem or what you are trying to accomplish.

– music2myear
Sep 6 '18 at 18:04





"Focus" is a concept of the OS, not Nircmd. A focused window is the active window, the one currently accepting user input, the highlighted one. If you are actively using a window, it is focused. If you are actively using one window, all other windows are NOT focused. So, what is not working? According to the Nircmd reference, you're already using the correct syntax. Please edit your question to clarify the actual problem or what you are trying to accomplish.

– music2myear
Sep 6 '18 at 18:04










1 Answer
1






active

oldest

votes


















0














I'm having this same problem. I noticed that if you use a Windows Shortcut Key, all windows will lose focus. Assumedly NirCmd is becoming the foreground application, preventing it from muting the right process. However, of course if you don't, you'll only be muting explorer.exe or cmd.exe or however you ran it. Unfortunately, the best fix I've found is to change the shortcut to this:



"nircmd.exe" cmdwait 1000 changeappvolume focused .2


And then quickly re-click the process you want muted. cmdwait is in milliseconds, so this will wait for a second before doing the muteappvolume command. Quite an awkward solution.



Update:
I've come up with a more automated way of doing it. First create a .txt file with the following:



sendmouse left click
wait 20
changeappvolume focused .2


Then change the shortcut to:



"nircmd.exe" script <path-to-text-file>/<text-file>.txt


Now you only need to make sure your mouse cursor is over the application you want to change the volume to.






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%2f1355343%2ffocusing-a-window-in-cmd-with-nircmd%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









    0














    I'm having this same problem. I noticed that if you use a Windows Shortcut Key, all windows will lose focus. Assumedly NirCmd is becoming the foreground application, preventing it from muting the right process. However, of course if you don't, you'll only be muting explorer.exe or cmd.exe or however you ran it. Unfortunately, the best fix I've found is to change the shortcut to this:



    "nircmd.exe" cmdwait 1000 changeappvolume focused .2


    And then quickly re-click the process you want muted. cmdwait is in milliseconds, so this will wait for a second before doing the muteappvolume command. Quite an awkward solution.



    Update:
    I've come up with a more automated way of doing it. First create a .txt file with the following:



    sendmouse left click
    wait 20
    changeappvolume focused .2


    Then change the shortcut to:



    "nircmd.exe" script <path-to-text-file>/<text-file>.txt


    Now you only need to make sure your mouse cursor is over the application you want to change the volume to.






    share|improve this answer






























      0














      I'm having this same problem. I noticed that if you use a Windows Shortcut Key, all windows will lose focus. Assumedly NirCmd is becoming the foreground application, preventing it from muting the right process. However, of course if you don't, you'll only be muting explorer.exe or cmd.exe or however you ran it. Unfortunately, the best fix I've found is to change the shortcut to this:



      "nircmd.exe" cmdwait 1000 changeappvolume focused .2


      And then quickly re-click the process you want muted. cmdwait is in milliseconds, so this will wait for a second before doing the muteappvolume command. Quite an awkward solution.



      Update:
      I've come up with a more automated way of doing it. First create a .txt file with the following:



      sendmouse left click
      wait 20
      changeappvolume focused .2


      Then change the shortcut to:



      "nircmd.exe" script <path-to-text-file>/<text-file>.txt


      Now you only need to make sure your mouse cursor is over the application you want to change the volume to.






      share|improve this answer




























        0












        0








        0







        I'm having this same problem. I noticed that if you use a Windows Shortcut Key, all windows will lose focus. Assumedly NirCmd is becoming the foreground application, preventing it from muting the right process. However, of course if you don't, you'll only be muting explorer.exe or cmd.exe or however you ran it. Unfortunately, the best fix I've found is to change the shortcut to this:



        "nircmd.exe" cmdwait 1000 changeappvolume focused .2


        And then quickly re-click the process you want muted. cmdwait is in milliseconds, so this will wait for a second before doing the muteappvolume command. Quite an awkward solution.



        Update:
        I've come up with a more automated way of doing it. First create a .txt file with the following:



        sendmouse left click
        wait 20
        changeappvolume focused .2


        Then change the shortcut to:



        "nircmd.exe" script <path-to-text-file>/<text-file>.txt


        Now you only need to make sure your mouse cursor is over the application you want to change the volume to.






        share|improve this answer















        I'm having this same problem. I noticed that if you use a Windows Shortcut Key, all windows will lose focus. Assumedly NirCmd is becoming the foreground application, preventing it from muting the right process. However, of course if you don't, you'll only be muting explorer.exe or cmd.exe or however you ran it. Unfortunately, the best fix I've found is to change the shortcut to this:



        "nircmd.exe" cmdwait 1000 changeappvolume focused .2


        And then quickly re-click the process you want muted. cmdwait is in milliseconds, so this will wait for a second before doing the muteappvolume command. Quite an awkward solution.



        Update:
        I've come up with a more automated way of doing it. First create a .txt file with the following:



        sendmouse left click
        wait 20
        changeappvolume focused .2


        Then change the shortcut to:



        "nircmd.exe" script <path-to-text-file>/<text-file>.txt


        Now you only need to make sure your mouse cursor is over the application you want to change the volume to.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 9 at 4:53

























        answered Feb 8 at 13:37









        gdigdi

        563




        563






























            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%2f1355343%2ffocusing-a-window-in-cmd-with-nircmd%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

            Mouse cursor on multiple screens with different PPI

            Agildo Ribeiro

            Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”