Board logo

标题: [ZT]Windows32位系统右下角托盘中的音量控制程序的命令行参数 [打印本页]

作者: rat    时间: 2008-11-24 22:13     标题: [ZT]Windows32位系统右下角托盘中的音量控制程序的命令行参数

sndvol32命令行参数
[ 2007-9-19 17:32:00 | ]


sndvol32是微软的一个音量控制组件,路径是C:\WINDOWS\system32\sndvol32.exe。
格式 :
sndvol32 [-Daudio_device_number] [-Record | -Play] [-Normal | -Small | -Tray]

说明:
注意到上面格式里有的参数大写了吗,凡是大写的参数可以简写为首字母。
-Record    录音模式
-Play        播放模式
-Normal    正常大小
-Small      简洁
-Tray        托盘大小(与用鼠标左键单击托盘里的音量控制图标弹出的窗口一样)
-D             只在安装了多个音频设备(如USB Phone)时才需要使用。

举例 :
sndvol32 -record 或sndvol32 -rec 或sndvol32 -r
sndvol32 -t
sndvol32 -D2 -R -S


技巧:

在打开的音量控制窗口中,可以使用“向上”或“向右”键增大滑块值、“向下”或“向左”键减小滑块值,但是改变的幅度比较小。要更快速地调节,可以使用“上页”键增大滑块值、“下页”键减小滑块值。

在打开的音量控制窗口中,按“ Ctrl + S ”键可以在简洁模式和一般模式间切换。



附:英文原文(http://home.austarnet.com.au/davekimble/volume-controls.htm

sndvol32 command line parameters

sndvol32 is a Microsoft applet that displays the volume controls.
It is normally located at C:\WINDOWS\system32\sndvol32.exe

Format :
sndvol32 [-Daudio_device_number] [-Record | -Play] [-Normal | -Small | -Tray]

The "-D" parameter is only needed if you have more than one audio device installed, such as a USB Phone in addition to your computer's built-in sound device.

Example :
sndvol32 -D2 -R -S
作者: wxcute    时间: 2008-11-25 17:00

厉害,第一次见这个资料。
作者: Cameron    时间: 2008-11-25 18:06

可以用命令行调节音量吗?
作者: rat    时间: 2008-11-25 19:43     标题: 回复 3楼 的帖子

可以用vbs的Sendkeys吧?或者写个控制台程序
作者: Cameron    时间: 2008-11-25 19:52

sendkeys容易落空啊,
至于控制台程序。。。。。。
我对硬件驱动不是很熟。。。。。。
作者: rat    时间: 2008-11-25 19:54     标题: 回复 5楼 的帖子

我对硬件驱动不是很熟

我完全不会:(
作者: Cameron    时间: 2008-11-26 17:59     标题: 回复 6楼 的帖子

windows有没有提供相关的API呢?
作者: pusofalse    时间: 2008-11-26 18:05

用au3写了一个命令行控制音量的,在我的网盘里。
http://pusofalse.ys168.com 密码是bathome
SoundSetVolume.rar  命令行修改系统音量
  1. @echo off
  2. ::sound <音量百分比>
  3. sound 50
  4. sound 100
复制代码

作者: Batcher    时间: 2008-11-26 18:15

NirCmd 里面的 setvolume
setvolume [device] [left-volume] [right-volume]
Set the volume level of your sound device. The [device] parameter represents the device identifier. In most cases, you should use '0' value for this parameter. Under Windows Vista, you should specify 0 for default playback device or 1 for default recording device.
The [left-volume] and [right-volume] parameters should contain a value between 0 (silence) and 65535 (full volume) that represents the volume level for left and right channels.
Examples:
setvolume 0 0 0
setvolume 0 32768 32768
setvolume 0 0xffff 0
setsysvolume [volume] {Component} {Device Index}
Set the sound volume for your system. Changing this value also affects the sound volume settings under 'Control Panel'. The [volume] parameter should contain a value between 0 (silence) and 65535 (full volume).
{Component} is an optional parameter that specifies one of the following sound components: master, waveout, synth, cd, microphone, phone, aux, line, headphones, wavein. The default value is 'master' (for master volume). Under Windows Vista, the component name must be identical to the one of the device names appear in the sound window of Vista (Control Panel -> Sound). If the device name contains spaces, it must be in quotes.
{Device Index} is an optional parameter that specifies the sound device index. This parameter is useful if you have more than one sound card. If you don't specify this parameter, the default sound card in Control Panel is used.
Examples:
setsysvolume 0x8000
setsysvolume 0
setsysvolume 25000 waveout
setsysvolume 25000 master 1
Vista Examples:
setsysvolume 0x8000
setsysvolume 0 "front mic"
setsysvolume 25000 speakers
setsysvolume 25000 "line in"
setsysvolume2 [left volume] [right volume] {Component} {Device Index}
Similar to setsysvolume, but instead of setting the whole sound volume, setsysvolume2 set the right channel and left channel separately.
Examples:
setsysvolume2 10000 20000
setsysvolume2 30000 0
setsysvolume2 25000 15000 waveout
setsysvolume2 30000 0 master 1

http://bbs.bathome.net/thread-1881-1-1.html

[ 本帖最后由 Batcher 于 2008-11-26 18:19 编辑 ]
作者: Cameron    时间: 2008-11-26 21:58

9楼的功能很丰富啊!
pusofalse能给出源码吗?
作者: slore    时间: 2008-11-26 23:05

Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Sendkeys ""  '静音
WshShell.Sendkeys ""  '减音
WshShell.Sendkeys ""  '增音
作者: tireless    时间: 2009-3-27 11:24     标题: 回复 11楼 的帖子

写错了。应该是:

"爱" 会执行“下一首”和“减音”




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2