Hey, I did do a search on this in the forum and I saw a SendKey method can be used to mute the volume, but I am interested in controlling the volume via batch, not just muting and unmuting.
Any ideas?
Thanks!
Changing Sound Volume using DOS
Moderator: DosItHelp
Re: Changing Sound Volume using DOS
AFAIK only via 3'd party tools like NirCmd by NirSoft ("changesysvolume" subcommand)
Re: Changing Sound Volume using DOS
Hmmm... which only gets me wondering, "How do third party tools do it?". I may give that a shot if nothing else pops up.
Thanks
Thanks
Re: Changing Sound Volume using DOS
sweener wrote:"How do third party tools do it?"
via Win32 API: http://support.microsoft.com/kb/178456
Re: Changing Sound Volume using DOS
Well, I did a bit more hunting and it turns out the best way to do this via simple automated means callable from DOS is to write a vbscript. Here's a little something I threw together based on some other stuff I found on ye olde internet:
Mind you there are more efficient ways to do that (WITH statement and other things)
and I would call the script from DOS:
which would set the volume about 50%.
Thanks for your reply though. The link you provided started me down a different path until I arrived at this. Thanks amel27!
Code: Select all
'volControlvbs
volUp=WScript.Arguments(0)
sender="{UP "& volUp & "}"
set shl=CreateObject("WScript.Shell")
shl.Run "sndvol32 -T", 2 'the 2 makes the app active and minimized
WScript.Sleep 50
shl.SendKeys "{END}" 'Sets volume to 0
shl.SendKeys sender 'emulates pressing up arrow %volup% amount of times
WScript.Sleep 50
shl.SendKeys "%{F4}" 'Exit app
Mind you there are more efficient ways to do that (WITH statement and other things)
and I would call the script from DOS:
Code: Select all
volControl.vbs 250
which would set the volume about 50%.
Thanks for your reply though. The link you provided started me down a different path until I arrived at this. Thanks amel27!