An audio device switcher written in Batch and Cscript using SoundVolumeView.
A collection of scripts that can set the default audio device, check the current default device, or switch between two devices.
- SoundVolumeCommandLine v1.25 by Nir Sofer - Website.
The scripts may work with other versions, but this is the version that was used during development.
- Download and unpack the dependency.
- Download the desired scripts and
variables.csv. The scripts are intentionally separate so you can download only the ones you need.
Tip
Place the files in the same folder as svcl.exe for ease of use.
- Update the
variables.csvfile to fit your setup:
SoundVolumeView,<relative path to svcl.exe>
TIMEOUT,<how many seconds information popups wait before automatically closing>
COLUMN,<name of the column in SoundVolumeView that indicates your default device>
DEFAULT,<keyword that appears in COLUMN for your default device>
S_DEVICE,<name of 1st audio device>
H_DEVICE,<name of 2nd audio device>
S_VOLUME,<default volume for 1st device>
H_VOLUME,<default volume for 2nd device>
Note
Variables are currently configured to switch between a Headset and Speakers. File names and code comments reflect this, but you can switch any two devices.
Displays which of the two devices is currently set as default in a popup. Shows an error if the current default isn't one of the two.
- SoundVolumeView, TIMEOUT, COLUMN, DEFAULT, H_DEVICE, S_DEVICE
- Reads variables from
VARS_PATH. - Uses
SoundVolumeViewto get the value ofCOLUMNforS_DEVICEandH_DEVICE. - Determines which device matches the
DEFAULTkeyword. - Displays info popup for
TIMEOUTseconds showing the current default device.
Switches the default device between the two options and sets the corresponding volume. If the current default device isn't one of the options, an error message is displayed.
- SoundVolumeView, TIMEOUT, COLUMN, DEFAULT, H_DEVICE, S_DEVICE, H_VOLUME, S_VOLUME
- Reads variables from
VARS_PATH. - Uses
SoundVolumeViewto get the value ofCOLUMNforS_DEVICEandH_DEVICE. - Determines which device matches the
DEFAULTkeyword. - Uses
SoundVolumeViewto switch default device to the other device. - Uses
SoundVolumeViewto set the new default device's volume to the corresponding default (H_VOLUMEorS_VOLUME). - Displays info popup for
TIMEOUTseconds confirming the switch.
Checks the current default device and prompts the user whether to switch to the other device. If "ok" is selected, it switches and adjusts volume. If the current default isn't one of the two devices, an error popup is shown.
- SoundVolumeView, TIMEOUT, COLUMN, DEFAULT, H_DEVICE, S_DEVICE, H_VOLUME, S_VOLUME
- Reads variables from
VARS_PATH(relative path tovariables.csv, declared inside the script) - Uses
SoundVolumeViewto get the value ofCOLUMNforS_DEVICEandH_DEVICE. - Determines which device matches the
DEFAULTkeyword. - Displays a prompt popup asking the user if they want to switch.
- If "ok":
- Switches the default device to the other device using
SoundVolumeView. - Sets the new device volume (
H_VOLUMEorS_VOLUME) - Displays info popup for
TIMEOUTseconds confirming the switch.
- Switches the default device to the other device using
- If "cancel": exits without making changes.
Sets H_DEVICE as the default audio device and adjusts volume accordingly, regardless of the current default.
- SoundVolumeView, TIMEOUT, H_DEVICE, H_VOLUME
- Reads variables from
VARS_PATH(relative path tovariables.csv, declared inside the script) - Switches default device to
H_DEVICEusingSoundVolumeView. - Sets volume to
H_VOLUME. - Displays info popup for
TIMEOUTseconds confirming the change.
Sets S_DEVICE as the default audio device and adjusts volume accordingly, regardless of the current default.
- SoundVolumeView, TIMEOUT, S_DEVICE, S_VOLUME
- Reads variables from
VARS_PATH(relative path tovariables.csv, declared inside the script) - Switches default device to
S_DEVICEusingSoundVolumeView. - Sets volume to
S_VOLUME. - Displays info popup for
TIMEOUTseconds confirming the change.
- Run the desired script to check or switch your default audio device.
Tip
Create a shortcut to the script on your desktop, open its properties, and set Run to Minimized. This allows it to run in the background, showing only the final popup result.
Run the script via the shortcut instead of directly to avoid multiple console windows.
Tip
If your keyboard or mouse has programmable buttons, you can assign them to run these shortcuts, allowing switching/checking audio devices without opening folders or the desktop.