Depending on your operating system, there is an option to 'force' your PC to connect to the network of your choice. In W7, for example, go to 'Network and Sharing Centre' in Control Panel, click on 'Manage wireless networks'. You should see a list of all those within range. Right click on the network you want to connect to, click on ' Properties' and tick the box marked 'Connect automatically when this network is within range'. There are similar facilities in XP and Vista.
What is ransomware and how do I protect my PC from Petya?