Switching 1 tunnel to other agents programmatically

I want to be able to switch my tunnel to one agent to another automatically. Is there a way i can achieve this using the command line or .bat files?

I’m having to use different devices in different locations and i have the exact same server files on both of them (using git), i wanna be able to easily just click a button and everything runs smoothly.

will it work if i just give both PCs the same secret key on the secret path?