Thanks to the link provided by and31415, I was able to McGyver a solution, using the Device Console (DevCon) utility.
I've copied the instructions for how to get the tool from this answer:
DevCon is a command-line tool that displays detailed information about devices, and lets you search for and manipulate devices from the command line. DevCon enables, disables, installs, configures, and removes devices on the local computer and displays detailed information about devices on local and remote computers.
Download the appropriate .cab
package depending on the operating system:
Open the .cab
archive and extract the file named fil[some letters and numbers]
. It should be about 80 KB.
- Rename it to
devcon.exe
.
Using this tool, I was able to figure out what the Hardware ID was for my soundcard, and use it to enable and disable the device. Seeing as I simply need to toggle the device, My Batch file simply looks like this:
devcon.exe disable "PCI\VEN_13F6&DEV_8788&SUBSYS_85221043"
devcon.exe enable "PCI\VEN_13F6&DEV_8788&SUBSYS_85221043"
That longish string is the Hardware device ID. To find this, I used DevCon's findall
command, piping the output to a text file for easy searching.
devcon.exe findall * > C:\output.txt
Searching for my device name, I copied the string that I needed.
Note: Unfortunately, the batch still requires Administrator Privileges to run, but that's a small issue (and one I may be able to solve at a later stage). But for now, this works for me.
devcon
utility. See this related question: Automatically disable integrated webcam when an external one is connected?