How to control Windows system volume using JScript or VBScript?

前端 未结 7 627
说谎
说谎 2020-12-03 06:10

I want to control the volume of my Windows system from a JScript or VBScript script. Any ideas?

Also, can I unmute the system volume if it is muted?

7条回答
  •  攒了一身酷
    2020-12-03 06:28

    Misty Manor's Answer Works on Windows Vita as well. This, i literally just made, does the same in a sense.

    set oShell = CreateObject("WScript.Shell") 
    oShell.run"%SystemRoot%\System32\SndVol.exe" 'Runs The Master Volume App.
    WScript.Sleep 1500 'Waits For The Program To Open
    oShell.SendKeys("{PGUP}") 'Turns Up The Volume 20, If It Is Muted Then It Will Unmute It
    oShell.SendKeys("{PGUP}") 'Turns Up The Volume 20
    oShell.SendKeys("{PGUP}") 'Turns Up The Volume 20
    oShell.SendKeys("{PGUP}") 'Turns Up The Volume 20
    oShell.SendKeys("{PGUP}") 'Turns Up The Volume 20
    oShell.SendKeys"%{F4}"  ' ALT F4 To Exit The App.
    

    If you want to decrease the volume you would do

    oShell.SendKeys("{PGDN}") 'It Will Decrease The Volume By 20
    

提交回复
热议问题