Change Windows sound volume via the command line












17















Is it possible to change the volume in Windows XP via the command line?










share|improve this question




















  • 1





    AutoHotkey can do this, which you could compile and call from the command line

    – Matthew Lock
    Sep 16 '09 at 11:47
















17















Is it possible to change the volume in Windows XP via the command line?










share|improve this question




















  • 1





    AutoHotkey can do this, which you could compile and call from the command line

    – Matthew Lock
    Sep 16 '09 at 11:47














17












17








17


5






Is it possible to change the volume in Windows XP via the command line?










share|improve this question
















Is it possible to change the volume in Windows XP via the command line?







windows windows-xp command-line audio






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 5 '15 at 17:34









Ƭᴇcʜιᴇ007

99k14156213




99k14156213










asked Sep 16 '09 at 10:59









underskorunderskor

2861313




2861313








  • 1





    AutoHotkey can do this, which you could compile and call from the command line

    – Matthew Lock
    Sep 16 '09 at 11:47














  • 1





    AutoHotkey can do this, which you could compile and call from the command line

    – Matthew Lock
    Sep 16 '09 at 11:47








1




1





AutoHotkey can do this, which you could compile and call from the command line

– Matthew Lock
Sep 16 '09 at 11:47





AutoHotkey can do this, which you could compile and call from the command line

– Matthew Lock
Sep 16 '09 at 11:47










4 Answers
4






active

oldest

votes


















28














NirCmd is an application that does that and more.



Example of use:




  • Increase the system volume by 2000 units (out of 65535)
    nircmd.exe changesysvolume 2000

  • Decrease the system volume by 5000 units (out of 65535)
    nircmd.exe changesysvolume -5000

  • Set the volume to the highest value
    nircmd.exe setsysvolume 65535

  • Mute
    nircmd.exe mutesysvolume 1

  • Unmute
    nircmd.exe mutesysvolume 0






share|improve this answer





















  • 1





    Was hoping there was a standard Windows method, but this looks very handy. Will accept this if no-one supplies one in the next day or two. Thanks, Harry.

    – underskor
    Sep 16 '09 at 12:02











  • NirCmd looks very cool and very handy. Thanks for the tip.

    – pave
    Sep 16 '09 at 13:08











  • NirCmd is also great for getting a laptop to mute on every logon - this way it won't accidentally keep making the "ding" sound on the train (which I don't notice because of the headphones until an embarrassing moment when someone gets annoyed enough to point it out.....)

    – RomanSt
    Jan 10 '10 at 15:08






  • 1





    This apparently also works on Windows 7, as a few now deleted non-answers pointed out earlier.

    – Daniel Beck
    Dec 17 '10 at 14:35











  • There's user-friendly interactive script I made for simplification that depends on nircmd.

    – w17t
    Jun 27 '15 at 15:40





















5














Make the JavaScript files:



echo var oShell = new ActiveXObject("WScript.Shell"); >> volup.js<BR>
echo oShell.SendKeys(String.fromCharCode(0xAF)); >> volup.js

echo var oShell = new ActiveXObject("WScript.Shell"); >> voldown.js<BR>
echo oShell.SendKeys(String.fromCharCode(0xAE)); >> voldown.js

echo var oShell = new ActiveXObject("WScript.Shell"); >> togglemute.js<BR>
echo oShell.SendKeys(String.fromCharCode(0xAD)); >> togglemute.js


Show the volume control, so you can see what you're doing:



sndvol
(or maybe sndvol32)


Change the volume:



cscript voldown.js


Note: I've had this approach work reliably on machines that I've attempted to use it on. Helen's answer to Sibo Lin's StackOverflow question about this indicates muting isn't reliable, but volume-changing may not be quite as reliable. I suspect that the level of reliability may be different on different machines. This approach is using the technology of mimicking a keystroke, and specifically a volume control key on an enhanced media keyboard. At the time that Windows started supporting this, such a keyboard was basically a little-used frivolous feature that offered functionality that was previously available only with custom drivers. It wouldn't surprise me if this code was less polished, and less likely to work on some of the various (perhaps older) hardware that's out there. All that said, I haven't had troubles with it myself.



Credits:




  • This answer was heavily influenced by Ryan's answer to Sibo Lin's question about changing the volume on the command line. (Having a good idea of how to do this, I looked for some example on how to get this done.)

  • I suspect that Ed Wilson's “Hey Scripting Guy!” blog on Microsoft: article about using a cheesy script to set speaker volume may have been the (direct or indirect) inspiration for many people who have suggested this approach.


One caveat: This question has been tagged with Windows XP. I just tried this in Windows 10. I know I've used this in Windows 7 (at least enough to test it out). As I first started to see Microsoft's built-in support for these enhanced keyboards around the time of Windows ME, I would think this is likely to work well win WinXP too. I don't recall if I actually tested this with that operating system. Still, if this approach doesn't work well, I don't expect it to cause problematic side effects.






share|improve this answer


























  • Thanks for sharing those keycodes! Since my computer already has python installed, I was able to use this on the command line: pip install SendKeys (pure Python package for emulating keystrokes), followed by python -c "from SendKeys import playkeys; playkeys([(0xAE, True), (0xAE, False)])", which emulates a single press and release of the volume key. To emulate 100 distinct presses (for example), you can insert * 100 after the closing ] and before the final ).

    – ArtOfWarfare
    Mar 1 '17 at 15:04



















4














Having read these posts and having looked for alternatives I decided to write my own command line utility, called SetVol, to set the volume. It works a little more simply than what is described in some of the other posts on this page, here are some examples that you would enter at the command prompt:



setvol 75
setvol -10
setvol +12
setvol mute
setvol unmute


There are other options too. I've released it as freeware, and you are welcome to visit www.rlatour.com/setvol for more information and to download a copy.



Enjoy






share|improve this answer


























  • This is brilliant. Thanks very much for this tool !

    – gibberish
    Oct 23 '18 at 16:12











  • Thanks!! However, I REALLY need this for setting the mic volume. (I'm using Java but I don't expect JavaSound to do this.) Can it be added?

    – Stefan Reich
    Nov 30 '18 at 16:46











  • Awesome, thank you! Feature Request for future: ability to return current volume level as an errorlevel (so I can save current setting to later restore it)

    – ashleedawg
    Dec 13 '18 at 17:48











  • Sure, I can do that - and in fact, just did! The program has been updated to version 1.2 on the website, you may need to refresh your browser to see the changes. There is now a new parm 'report' that should give you what you want. Help on the website and in the app explains it use. Merry Christmas!

    – Rob
    Dec 18 '18 at 14:43











  • (that it say return the current volume level as per ashleedawg's suggestion)

    – Rob
    Dec 18 '18 at 14:51



















2














Owing and further simplifying Nircmd



@echo off
rem 65536 is 100%
rem device where zero is the default device
rem left and right
rem supports whole numbers only therefore throws "missing operator" error when specifying 655.36
set /a volume=%1 * 655
nircmd setvolume 0 %volume% %volume%


save it as a .bat file and execute by passing a parameter



eg: sound 60 will set the the sound volume 60%



make sure you put the bat file either next to the nircmd or in %windir% (or define its folder in %path%)






share|improve this answer






















    protected by Community Jan 2 at 9:49



    Thank you for your interest in this question.
    Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



    Would you like to answer one of these unanswered questions instead?














    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    28














    NirCmd is an application that does that and more.



    Example of use:




    • Increase the system volume by 2000 units (out of 65535)
      nircmd.exe changesysvolume 2000

    • Decrease the system volume by 5000 units (out of 65535)
      nircmd.exe changesysvolume -5000

    • Set the volume to the highest value
      nircmd.exe setsysvolume 65535

    • Mute
      nircmd.exe mutesysvolume 1

    • Unmute
      nircmd.exe mutesysvolume 0






    share|improve this answer





















    • 1





      Was hoping there was a standard Windows method, but this looks very handy. Will accept this if no-one supplies one in the next day or two. Thanks, Harry.

      – underskor
      Sep 16 '09 at 12:02











    • NirCmd looks very cool and very handy. Thanks for the tip.

      – pave
      Sep 16 '09 at 13:08











    • NirCmd is also great for getting a laptop to mute on every logon - this way it won't accidentally keep making the "ding" sound on the train (which I don't notice because of the headphones until an embarrassing moment when someone gets annoyed enough to point it out.....)

      – RomanSt
      Jan 10 '10 at 15:08






    • 1





      This apparently also works on Windows 7, as a few now deleted non-answers pointed out earlier.

      – Daniel Beck
      Dec 17 '10 at 14:35











    • There's user-friendly interactive script I made for simplification that depends on nircmd.

      – w17t
      Jun 27 '15 at 15:40


















    28














    NirCmd is an application that does that and more.



    Example of use:




    • Increase the system volume by 2000 units (out of 65535)
      nircmd.exe changesysvolume 2000

    • Decrease the system volume by 5000 units (out of 65535)
      nircmd.exe changesysvolume -5000

    • Set the volume to the highest value
      nircmd.exe setsysvolume 65535

    • Mute
      nircmd.exe mutesysvolume 1

    • Unmute
      nircmd.exe mutesysvolume 0






    share|improve this answer





















    • 1





      Was hoping there was a standard Windows method, but this looks very handy. Will accept this if no-one supplies one in the next day or two. Thanks, Harry.

      – underskor
      Sep 16 '09 at 12:02











    • NirCmd looks very cool and very handy. Thanks for the tip.

      – pave
      Sep 16 '09 at 13:08











    • NirCmd is also great for getting a laptop to mute on every logon - this way it won't accidentally keep making the "ding" sound on the train (which I don't notice because of the headphones until an embarrassing moment when someone gets annoyed enough to point it out.....)

      – RomanSt
      Jan 10 '10 at 15:08






    • 1





      This apparently also works on Windows 7, as a few now deleted non-answers pointed out earlier.

      – Daniel Beck
      Dec 17 '10 at 14:35











    • There's user-friendly interactive script I made for simplification that depends on nircmd.

      – w17t
      Jun 27 '15 at 15:40
















    28












    28








    28







    NirCmd is an application that does that and more.



    Example of use:




    • Increase the system volume by 2000 units (out of 65535)
      nircmd.exe changesysvolume 2000

    • Decrease the system volume by 5000 units (out of 65535)
      nircmd.exe changesysvolume -5000

    • Set the volume to the highest value
      nircmd.exe setsysvolume 65535

    • Mute
      nircmd.exe mutesysvolume 1

    • Unmute
      nircmd.exe mutesysvolume 0






    share|improve this answer















    NirCmd is an application that does that and more.



    Example of use:




    • Increase the system volume by 2000 units (out of 65535)
      nircmd.exe changesysvolume 2000

    • Decrease the system volume by 5000 units (out of 65535)
      nircmd.exe changesysvolume -5000

    • Set the volume to the highest value
      nircmd.exe setsysvolume 65535

    • Mute
      nircmd.exe mutesysvolume 1

    • Unmute
      nircmd.exe mutesysvolume 0







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 25 '15 at 19:32









    Aaron Thoma

    509416




    509416










    answered Sep 16 '09 at 11:12









    harrymcharrymc

    255k14266566




    255k14266566








    • 1





      Was hoping there was a standard Windows method, but this looks very handy. Will accept this if no-one supplies one in the next day or two. Thanks, Harry.

      – underskor
      Sep 16 '09 at 12:02











    • NirCmd looks very cool and very handy. Thanks for the tip.

      – pave
      Sep 16 '09 at 13:08











    • NirCmd is also great for getting a laptop to mute on every logon - this way it won't accidentally keep making the "ding" sound on the train (which I don't notice because of the headphones until an embarrassing moment when someone gets annoyed enough to point it out.....)

      – RomanSt
      Jan 10 '10 at 15:08






    • 1





      This apparently also works on Windows 7, as a few now deleted non-answers pointed out earlier.

      – Daniel Beck
      Dec 17 '10 at 14:35











    • There's user-friendly interactive script I made for simplification that depends on nircmd.

      – w17t
      Jun 27 '15 at 15:40
















    • 1





      Was hoping there was a standard Windows method, but this looks very handy. Will accept this if no-one supplies one in the next day or two. Thanks, Harry.

      – underskor
      Sep 16 '09 at 12:02











    • NirCmd looks very cool and very handy. Thanks for the tip.

      – pave
      Sep 16 '09 at 13:08











    • NirCmd is also great for getting a laptop to mute on every logon - this way it won't accidentally keep making the "ding" sound on the train (which I don't notice because of the headphones until an embarrassing moment when someone gets annoyed enough to point it out.....)

      – RomanSt
      Jan 10 '10 at 15:08






    • 1





      This apparently also works on Windows 7, as a few now deleted non-answers pointed out earlier.

      – Daniel Beck
      Dec 17 '10 at 14:35











    • There's user-friendly interactive script I made for simplification that depends on nircmd.

      – w17t
      Jun 27 '15 at 15:40










    1




    1





    Was hoping there was a standard Windows method, but this looks very handy. Will accept this if no-one supplies one in the next day or two. Thanks, Harry.

    – underskor
    Sep 16 '09 at 12:02





    Was hoping there was a standard Windows method, but this looks very handy. Will accept this if no-one supplies one in the next day or two. Thanks, Harry.

    – underskor
    Sep 16 '09 at 12:02













    NirCmd looks very cool and very handy. Thanks for the tip.

    – pave
    Sep 16 '09 at 13:08





    NirCmd looks very cool and very handy. Thanks for the tip.

    – pave
    Sep 16 '09 at 13:08













    NirCmd is also great for getting a laptop to mute on every logon - this way it won't accidentally keep making the "ding" sound on the train (which I don't notice because of the headphones until an embarrassing moment when someone gets annoyed enough to point it out.....)

    – RomanSt
    Jan 10 '10 at 15:08





    NirCmd is also great for getting a laptop to mute on every logon - this way it won't accidentally keep making the "ding" sound on the train (which I don't notice because of the headphones until an embarrassing moment when someone gets annoyed enough to point it out.....)

    – RomanSt
    Jan 10 '10 at 15:08




    1




    1





    This apparently also works on Windows 7, as a few now deleted non-answers pointed out earlier.

    – Daniel Beck
    Dec 17 '10 at 14:35





    This apparently also works on Windows 7, as a few now deleted non-answers pointed out earlier.

    – Daniel Beck
    Dec 17 '10 at 14:35













    There's user-friendly interactive script I made for simplification that depends on nircmd.

    – w17t
    Jun 27 '15 at 15:40







    There's user-friendly interactive script I made for simplification that depends on nircmd.

    – w17t
    Jun 27 '15 at 15:40















    5














    Make the JavaScript files:



    echo var oShell = new ActiveXObject("WScript.Shell"); >> volup.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAF)); >> volup.js

    echo var oShell = new ActiveXObject("WScript.Shell"); >> voldown.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAE)); >> voldown.js

    echo var oShell = new ActiveXObject("WScript.Shell"); >> togglemute.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAD)); >> togglemute.js


    Show the volume control, so you can see what you're doing:



    sndvol
    (or maybe sndvol32)


    Change the volume:



    cscript voldown.js


    Note: I've had this approach work reliably on machines that I've attempted to use it on. Helen's answer to Sibo Lin's StackOverflow question about this indicates muting isn't reliable, but volume-changing may not be quite as reliable. I suspect that the level of reliability may be different on different machines. This approach is using the technology of mimicking a keystroke, and specifically a volume control key on an enhanced media keyboard. At the time that Windows started supporting this, such a keyboard was basically a little-used frivolous feature that offered functionality that was previously available only with custom drivers. It wouldn't surprise me if this code was less polished, and less likely to work on some of the various (perhaps older) hardware that's out there. All that said, I haven't had troubles with it myself.



    Credits:




    • This answer was heavily influenced by Ryan's answer to Sibo Lin's question about changing the volume on the command line. (Having a good idea of how to do this, I looked for some example on how to get this done.)

    • I suspect that Ed Wilson's “Hey Scripting Guy!” blog on Microsoft: article about using a cheesy script to set speaker volume may have been the (direct or indirect) inspiration for many people who have suggested this approach.


    One caveat: This question has been tagged with Windows XP. I just tried this in Windows 10. I know I've used this in Windows 7 (at least enough to test it out). As I first started to see Microsoft's built-in support for these enhanced keyboards around the time of Windows ME, I would think this is likely to work well win WinXP too. I don't recall if I actually tested this with that operating system. Still, if this approach doesn't work well, I don't expect it to cause problematic side effects.






    share|improve this answer


























    • Thanks for sharing those keycodes! Since my computer already has python installed, I was able to use this on the command line: pip install SendKeys (pure Python package for emulating keystrokes), followed by python -c "from SendKeys import playkeys; playkeys([(0xAE, True), (0xAE, False)])", which emulates a single press and release of the volume key. To emulate 100 distinct presses (for example), you can insert * 100 after the closing ] and before the final ).

      – ArtOfWarfare
      Mar 1 '17 at 15:04
















    5














    Make the JavaScript files:



    echo var oShell = new ActiveXObject("WScript.Shell"); >> volup.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAF)); >> volup.js

    echo var oShell = new ActiveXObject("WScript.Shell"); >> voldown.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAE)); >> voldown.js

    echo var oShell = new ActiveXObject("WScript.Shell"); >> togglemute.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAD)); >> togglemute.js


    Show the volume control, so you can see what you're doing:



    sndvol
    (or maybe sndvol32)


    Change the volume:



    cscript voldown.js


    Note: I've had this approach work reliably on machines that I've attempted to use it on. Helen's answer to Sibo Lin's StackOverflow question about this indicates muting isn't reliable, but volume-changing may not be quite as reliable. I suspect that the level of reliability may be different on different machines. This approach is using the technology of mimicking a keystroke, and specifically a volume control key on an enhanced media keyboard. At the time that Windows started supporting this, such a keyboard was basically a little-used frivolous feature that offered functionality that was previously available only with custom drivers. It wouldn't surprise me if this code was less polished, and less likely to work on some of the various (perhaps older) hardware that's out there. All that said, I haven't had troubles with it myself.



    Credits:




    • This answer was heavily influenced by Ryan's answer to Sibo Lin's question about changing the volume on the command line. (Having a good idea of how to do this, I looked for some example on how to get this done.)

    • I suspect that Ed Wilson's “Hey Scripting Guy!” blog on Microsoft: article about using a cheesy script to set speaker volume may have been the (direct or indirect) inspiration for many people who have suggested this approach.


    One caveat: This question has been tagged with Windows XP. I just tried this in Windows 10. I know I've used this in Windows 7 (at least enough to test it out). As I first started to see Microsoft's built-in support for these enhanced keyboards around the time of Windows ME, I would think this is likely to work well win WinXP too. I don't recall if I actually tested this with that operating system. Still, if this approach doesn't work well, I don't expect it to cause problematic side effects.






    share|improve this answer


























    • Thanks for sharing those keycodes! Since my computer already has python installed, I was able to use this on the command line: pip install SendKeys (pure Python package for emulating keystrokes), followed by python -c "from SendKeys import playkeys; playkeys([(0xAE, True), (0xAE, False)])", which emulates a single press and release of the volume key. To emulate 100 distinct presses (for example), you can insert * 100 after the closing ] and before the final ).

      – ArtOfWarfare
      Mar 1 '17 at 15:04














    5












    5








    5







    Make the JavaScript files:



    echo var oShell = new ActiveXObject("WScript.Shell"); >> volup.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAF)); >> volup.js

    echo var oShell = new ActiveXObject("WScript.Shell"); >> voldown.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAE)); >> voldown.js

    echo var oShell = new ActiveXObject("WScript.Shell"); >> togglemute.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAD)); >> togglemute.js


    Show the volume control, so you can see what you're doing:



    sndvol
    (or maybe sndvol32)


    Change the volume:



    cscript voldown.js


    Note: I've had this approach work reliably on machines that I've attempted to use it on. Helen's answer to Sibo Lin's StackOverflow question about this indicates muting isn't reliable, but volume-changing may not be quite as reliable. I suspect that the level of reliability may be different on different machines. This approach is using the technology of mimicking a keystroke, and specifically a volume control key on an enhanced media keyboard. At the time that Windows started supporting this, such a keyboard was basically a little-used frivolous feature that offered functionality that was previously available only with custom drivers. It wouldn't surprise me if this code was less polished, and less likely to work on some of the various (perhaps older) hardware that's out there. All that said, I haven't had troubles with it myself.



    Credits:




    • This answer was heavily influenced by Ryan's answer to Sibo Lin's question about changing the volume on the command line. (Having a good idea of how to do this, I looked for some example on how to get this done.)

    • I suspect that Ed Wilson's “Hey Scripting Guy!” blog on Microsoft: article about using a cheesy script to set speaker volume may have been the (direct or indirect) inspiration for many people who have suggested this approach.


    One caveat: This question has been tagged with Windows XP. I just tried this in Windows 10. I know I've used this in Windows 7 (at least enough to test it out). As I first started to see Microsoft's built-in support for these enhanced keyboards around the time of Windows ME, I would think this is likely to work well win WinXP too. I don't recall if I actually tested this with that operating system. Still, if this approach doesn't work well, I don't expect it to cause problematic side effects.






    share|improve this answer















    Make the JavaScript files:



    echo var oShell = new ActiveXObject("WScript.Shell"); >> volup.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAF)); >> volup.js

    echo var oShell = new ActiveXObject("WScript.Shell"); >> voldown.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAE)); >> voldown.js

    echo var oShell = new ActiveXObject("WScript.Shell"); >> togglemute.js<BR>
    echo oShell.SendKeys(String.fromCharCode(0xAD)); >> togglemute.js


    Show the volume control, so you can see what you're doing:



    sndvol
    (or maybe sndvol32)


    Change the volume:



    cscript voldown.js


    Note: I've had this approach work reliably on machines that I've attempted to use it on. Helen's answer to Sibo Lin's StackOverflow question about this indicates muting isn't reliable, but volume-changing may not be quite as reliable. I suspect that the level of reliability may be different on different machines. This approach is using the technology of mimicking a keystroke, and specifically a volume control key on an enhanced media keyboard. At the time that Windows started supporting this, such a keyboard was basically a little-used frivolous feature that offered functionality that was previously available only with custom drivers. It wouldn't surprise me if this code was less polished, and less likely to work on some of the various (perhaps older) hardware that's out there. All that said, I haven't had troubles with it myself.



    Credits:




    • This answer was heavily influenced by Ryan's answer to Sibo Lin's question about changing the volume on the command line. (Having a good idea of how to do this, I looked for some example on how to get this done.)

    • I suspect that Ed Wilson's “Hey Scripting Guy!” blog on Microsoft: article about using a cheesy script to set speaker volume may have been the (direct or indirect) inspiration for many people who have suggested this approach.


    One caveat: This question has been tagged with Windows XP. I just tried this in Windows 10. I know I've used this in Windows 7 (at least enough to test it out). As I first started to see Microsoft's built-in support for these enhanced keyboards around the time of Windows ME, I would think this is likely to work well win WinXP too. I don't recall if I actually tested this with that operating system. Still, if this approach doesn't work well, I don't expect it to cause problematic side effects.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jun 4 '18 at 14:58









    phuclv

    8,99063889




    8,99063889










    answered Oct 2 '16 at 15:21









    TOOGAMTOOGAM

    11.4k32644




    11.4k32644













    • Thanks for sharing those keycodes! Since my computer already has python installed, I was able to use this on the command line: pip install SendKeys (pure Python package for emulating keystrokes), followed by python -c "from SendKeys import playkeys; playkeys([(0xAE, True), (0xAE, False)])", which emulates a single press and release of the volume key. To emulate 100 distinct presses (for example), you can insert * 100 after the closing ] and before the final ).

      – ArtOfWarfare
      Mar 1 '17 at 15:04



















    • Thanks for sharing those keycodes! Since my computer already has python installed, I was able to use this on the command line: pip install SendKeys (pure Python package for emulating keystrokes), followed by python -c "from SendKeys import playkeys; playkeys([(0xAE, True), (0xAE, False)])", which emulates a single press and release of the volume key. To emulate 100 distinct presses (for example), you can insert * 100 after the closing ] and before the final ).

      – ArtOfWarfare
      Mar 1 '17 at 15:04

















    Thanks for sharing those keycodes! Since my computer already has python installed, I was able to use this on the command line: pip install SendKeys (pure Python package for emulating keystrokes), followed by python -c "from SendKeys import playkeys; playkeys([(0xAE, True), (0xAE, False)])", which emulates a single press and release of the volume key. To emulate 100 distinct presses (for example), you can insert * 100 after the closing ] and before the final ).

    – ArtOfWarfare
    Mar 1 '17 at 15:04





    Thanks for sharing those keycodes! Since my computer already has python installed, I was able to use this on the command line: pip install SendKeys (pure Python package for emulating keystrokes), followed by python -c "from SendKeys import playkeys; playkeys([(0xAE, True), (0xAE, False)])", which emulates a single press and release of the volume key. To emulate 100 distinct presses (for example), you can insert * 100 after the closing ] and before the final ).

    – ArtOfWarfare
    Mar 1 '17 at 15:04











    4














    Having read these posts and having looked for alternatives I decided to write my own command line utility, called SetVol, to set the volume. It works a little more simply than what is described in some of the other posts on this page, here are some examples that you would enter at the command prompt:



    setvol 75
    setvol -10
    setvol +12
    setvol mute
    setvol unmute


    There are other options too. I've released it as freeware, and you are welcome to visit www.rlatour.com/setvol for more information and to download a copy.



    Enjoy






    share|improve this answer


























    • This is brilliant. Thanks very much for this tool !

      – gibberish
      Oct 23 '18 at 16:12











    • Thanks!! However, I REALLY need this for setting the mic volume. (I'm using Java but I don't expect JavaSound to do this.) Can it be added?

      – Stefan Reich
      Nov 30 '18 at 16:46











    • Awesome, thank you! Feature Request for future: ability to return current volume level as an errorlevel (so I can save current setting to later restore it)

      – ashleedawg
      Dec 13 '18 at 17:48











    • Sure, I can do that - and in fact, just did! The program has been updated to version 1.2 on the website, you may need to refresh your browser to see the changes. There is now a new parm 'report' that should give you what you want. Help on the website and in the app explains it use. Merry Christmas!

      – Rob
      Dec 18 '18 at 14:43











    • (that it say return the current volume level as per ashleedawg's suggestion)

      – Rob
      Dec 18 '18 at 14:51
















    4














    Having read these posts and having looked for alternatives I decided to write my own command line utility, called SetVol, to set the volume. It works a little more simply than what is described in some of the other posts on this page, here are some examples that you would enter at the command prompt:



    setvol 75
    setvol -10
    setvol +12
    setvol mute
    setvol unmute


    There are other options too. I've released it as freeware, and you are welcome to visit www.rlatour.com/setvol for more information and to download a copy.



    Enjoy






    share|improve this answer


























    • This is brilliant. Thanks very much for this tool !

      – gibberish
      Oct 23 '18 at 16:12











    • Thanks!! However, I REALLY need this for setting the mic volume. (I'm using Java but I don't expect JavaSound to do this.) Can it be added?

      – Stefan Reich
      Nov 30 '18 at 16:46











    • Awesome, thank you! Feature Request for future: ability to return current volume level as an errorlevel (so I can save current setting to later restore it)

      – ashleedawg
      Dec 13 '18 at 17:48











    • Sure, I can do that - and in fact, just did! The program has been updated to version 1.2 on the website, you may need to refresh your browser to see the changes. There is now a new parm 'report' that should give you what you want. Help on the website and in the app explains it use. Merry Christmas!

      – Rob
      Dec 18 '18 at 14:43











    • (that it say return the current volume level as per ashleedawg's suggestion)

      – Rob
      Dec 18 '18 at 14:51














    4












    4








    4







    Having read these posts and having looked for alternatives I decided to write my own command line utility, called SetVol, to set the volume. It works a little more simply than what is described in some of the other posts on this page, here are some examples that you would enter at the command prompt:



    setvol 75
    setvol -10
    setvol +12
    setvol mute
    setvol unmute


    There are other options too. I've released it as freeware, and you are welcome to visit www.rlatour.com/setvol for more information and to download a copy.



    Enjoy






    share|improve this answer















    Having read these posts and having looked for alternatives I decided to write my own command line utility, called SetVol, to set the volume. It works a little more simply than what is described in some of the other posts on this page, here are some examples that you would enter at the command prompt:



    setvol 75
    setvol -10
    setvol +12
    setvol mute
    setvol unmute


    There are other options too. I've released it as freeware, and you are welcome to visit www.rlatour.com/setvol for more information and to download a copy.



    Enjoy







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Feb 24 '18 at 17:00

























    answered Feb 24 '18 at 16:53









    RobRob

    32826




    32826













    • This is brilliant. Thanks very much for this tool !

      – gibberish
      Oct 23 '18 at 16:12











    • Thanks!! However, I REALLY need this for setting the mic volume. (I'm using Java but I don't expect JavaSound to do this.) Can it be added?

      – Stefan Reich
      Nov 30 '18 at 16:46











    • Awesome, thank you! Feature Request for future: ability to return current volume level as an errorlevel (so I can save current setting to later restore it)

      – ashleedawg
      Dec 13 '18 at 17:48











    • Sure, I can do that - and in fact, just did! The program has been updated to version 1.2 on the website, you may need to refresh your browser to see the changes. There is now a new parm 'report' that should give you what you want. Help on the website and in the app explains it use. Merry Christmas!

      – Rob
      Dec 18 '18 at 14:43











    • (that it say return the current volume level as per ashleedawg's suggestion)

      – Rob
      Dec 18 '18 at 14:51



















    • This is brilliant. Thanks very much for this tool !

      – gibberish
      Oct 23 '18 at 16:12











    • Thanks!! However, I REALLY need this for setting the mic volume. (I'm using Java but I don't expect JavaSound to do this.) Can it be added?

      – Stefan Reich
      Nov 30 '18 at 16:46











    • Awesome, thank you! Feature Request for future: ability to return current volume level as an errorlevel (so I can save current setting to later restore it)

      – ashleedawg
      Dec 13 '18 at 17:48











    • Sure, I can do that - and in fact, just did! The program has been updated to version 1.2 on the website, you may need to refresh your browser to see the changes. There is now a new parm 'report' that should give you what you want. Help on the website and in the app explains it use. Merry Christmas!

      – Rob
      Dec 18 '18 at 14:43











    • (that it say return the current volume level as per ashleedawg's suggestion)

      – Rob
      Dec 18 '18 at 14:51

















    This is brilliant. Thanks very much for this tool !

    – gibberish
    Oct 23 '18 at 16:12





    This is brilliant. Thanks very much for this tool !

    – gibberish
    Oct 23 '18 at 16:12













    Thanks!! However, I REALLY need this for setting the mic volume. (I'm using Java but I don't expect JavaSound to do this.) Can it be added?

    – Stefan Reich
    Nov 30 '18 at 16:46





    Thanks!! However, I REALLY need this for setting the mic volume. (I'm using Java but I don't expect JavaSound to do this.) Can it be added?

    – Stefan Reich
    Nov 30 '18 at 16:46













    Awesome, thank you! Feature Request for future: ability to return current volume level as an errorlevel (so I can save current setting to later restore it)

    – ashleedawg
    Dec 13 '18 at 17:48





    Awesome, thank you! Feature Request for future: ability to return current volume level as an errorlevel (so I can save current setting to later restore it)

    – ashleedawg
    Dec 13 '18 at 17:48













    Sure, I can do that - and in fact, just did! The program has been updated to version 1.2 on the website, you may need to refresh your browser to see the changes. There is now a new parm 'report' that should give you what you want. Help on the website and in the app explains it use. Merry Christmas!

    – Rob
    Dec 18 '18 at 14:43





    Sure, I can do that - and in fact, just did! The program has been updated to version 1.2 on the website, you may need to refresh your browser to see the changes. There is now a new parm 'report' that should give you what you want. Help on the website and in the app explains it use. Merry Christmas!

    – Rob
    Dec 18 '18 at 14:43













    (that it say return the current volume level as per ashleedawg's suggestion)

    – Rob
    Dec 18 '18 at 14:51





    (that it say return the current volume level as per ashleedawg's suggestion)

    – Rob
    Dec 18 '18 at 14:51











    2














    Owing and further simplifying Nircmd



    @echo off
    rem 65536 is 100%
    rem device where zero is the default device
    rem left and right
    rem supports whole numbers only therefore throws "missing operator" error when specifying 655.36
    set /a volume=%1 * 655
    nircmd setvolume 0 %volume% %volume%


    save it as a .bat file and execute by passing a parameter



    eg: sound 60 will set the the sound volume 60%



    make sure you put the bat file either next to the nircmd or in %windir% (or define its folder in %path%)






    share|improve this answer




























      2














      Owing and further simplifying Nircmd



      @echo off
      rem 65536 is 100%
      rem device where zero is the default device
      rem left and right
      rem supports whole numbers only therefore throws "missing operator" error when specifying 655.36
      set /a volume=%1 * 655
      nircmd setvolume 0 %volume% %volume%


      save it as a .bat file and execute by passing a parameter



      eg: sound 60 will set the the sound volume 60%



      make sure you put the bat file either next to the nircmd or in %windir% (or define its folder in %path%)






      share|improve this answer


























        2












        2








        2







        Owing and further simplifying Nircmd



        @echo off
        rem 65536 is 100%
        rem device where zero is the default device
        rem left and right
        rem supports whole numbers only therefore throws "missing operator" error when specifying 655.36
        set /a volume=%1 * 655
        nircmd setvolume 0 %volume% %volume%


        save it as a .bat file and execute by passing a parameter



        eg: sound 60 will set the the sound volume 60%



        make sure you put the bat file either next to the nircmd or in %windir% (or define its folder in %path%)






        share|improve this answer













        Owing and further simplifying Nircmd



        @echo off
        rem 65536 is 100%
        rem device where zero is the default device
        rem left and right
        rem supports whole numbers only therefore throws "missing operator" error when specifying 655.36
        set /a volume=%1 * 655
        nircmd setvolume 0 %volume% %volume%


        save it as a .bat file and execute by passing a parameter



        eg: sound 60 will set the the sound volume 60%



        make sure you put the bat file either next to the nircmd or in %windir% (or define its folder in %path%)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 2 '16 at 13:09









        w17tw17t

        2,26441638




        2,26441638

















            protected by Community Jan 2 at 9:49



            Thank you for your interest in this question.
            Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



            Would you like to answer one of these unanswered questions instead?



            Popular posts from this blog

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

            Grease: Live!

            When does type information flow backwards in C++?