I've never been asked for confirmation... probably because I run devcon.exe from Autohotkey scripts, and I've setup Autohotkey to always run with elevated rights, so everything I run from it will run with elevated rights itself...
Maybe you could try that (right click on the main Autohotkey.exe in program files, the option is in Properties, Compatibility)
Your AHK script line to work on devcon.exe should look like this:
Run devcon.exe remove HID\VID_057E&PID_0306&REV_0100&MI_00
Exitapp(I'll keep using my random HID so you get exactly how it would look. Also I'm assuming everything is on the same path. If not, you should replace all exe calls with the full path, example: "c:\whatever\devcon.exe", quotation marks and all, instead of just devcon.exe)If you set up Autohotkey to always run with elevated right you shouldn't need any confirmation with a script like that. If it works, you can add the "Hide" parameter so the command line windows run silently, like:
Run devcon.exe remove HID\VID_057E&PID_0306&REV_0100&MI_00,, Hide
ExitappNote the double comma, it's because every comma in AHK syntax marks a different parameter. In this case, the entire run command is parameter 1, then we're leaving the 2nd parameter blank (which is changing the starting directory, it defaults to the executable's path), and the 3rd parameter is where "Hide" should be.If it works, you could even setup a single launcher file that does everything for you:
Run devcon.exe disable HID\VID_057E&PID_0306&REV_0100&MI_00
RunWait MKX.exe
Run devcon.exe enable HID\VID_057E&PID_0306&REV_0100&MI_00
ExitappWhat that would:
1. disables the device through devcon
2. runs you main app (in this case I'm assuming it's mkx.exe), and waits for it process to close. Once it closes...
3. reenables the device through devcon
And again, once you confirm that works as expected, you can add the "Hide" parameter to the devcon prompts
Run devcon.exe disable HID\VID_057E&PID_0306&REV_0100&MI_00,, Hide
RunWait MKX.exe
Run devcon.exe enable HID\VID_057E&PID_0306&REV_0100&MI_00,, Hide
ExitappSee if that works. If you don't want to work with AHK and do everythign through bats you'll have to figure that out yourself, I know AHK way more than I know regular bat scripts at this point
Also, keep in mind AHK scripts can be compiled into standalone EXE files... So if you don't want to setup the main Autohotkey.exe file to always run as administrator for some reason, you can always compile this script alone (once you confirm it works reliably), and only set this particular EXE to run with elevated rights.
Another possible problem you can have with the "do it all" script is that some programs don't use the same process all the way through (for example, some games that open from some kind of launcher before opening the main game from a different exe file, and the launching process AHK waits to be closed closes before the main game does). In a case like that you'll have to figure out another way of correctly detecting when the game closes (there's several ways to do that). You probably won't have this problem but I wanted to mention it just in case you start writing similar scripts to solve other problems with other games.
Once you get the hang of it it's very fun to be able to fix every little nuance you thought you had no control over