Launch batch script from keyboard software
I was in need of a script that could change my output device between my speakers and my headphone because I do need to change between them quite often and going trough the GUI was starting to become annoying.
After consulting this question on stack overflow, I found out about Nircmd, a little piece of software that adds lots of useful fonctionnalities, among them, the one that I need.
I ended up making two batch files
setSpeakersAsOutput.bat :
nircmd.exe setdefaultsounddevice "Speakers"
setHeadPhoneAsOutput.bat :
nircmd.exe setdefaultsounddevice "EarForce X11"
I added nircmd.exe to my path. The two commands work when I execute them from a command line and it also works when I execute the ".bat" files from my file explorer but when I map the execution to a keyboard macro via my Razer Synapse software, it doesn't work. I see the CMD pop up for a second and close, like expected, but it doesn't change the settings.
My only hypothesis is that executing those scripts require administrative previleges and consequently, they can't be launched by a software. Even if this is the problem, I have no idea how to solve it.
Any help would be appreciated!
I run
- Windows 8.1
- I use Razer Synapse to control my Razer BlackWidow Chroma keyboard
Solution 1:
This is supposed to be a comment, but since I have to earn reputation from scratch on every site ....
As an alternative, you could add links to the scripts on your windows desktop and assign those keyboard shortcuts. This would make the batch files being called like you doubleclicking them.