After a bit more testing, I realized that RunOnSwitch seems to work fine for me with other command lines; it just doesn't like devcon.exe, or devcon.exe doesn't like it, for some reason. Maybe there's some weird timing issue. I'll try adding a pause before running devcon.exe and see if that helps.
No, that didn't help. It's perfectly bizarre, because when devcon reports that the mouse is enabled, the mouse is actually disabled, and when it reports the mouse is disabled, the mouse works. Yet when I use devcon to enable/disable the mouse in a normal command window, it works as expected. For some bizarre reason, using devcon with RunOnSwitch causes its effect to be 180 degrees out of phase with what it reports. Any idea why this might be happening?