Script for Starting Firefox?

Presently I have a powershell script (windows only, of course) that enumerates all the instances of "Internet Explorer" running on my machine and if at least one exists, the script creates a new tab in that instance with the URL I have provided. If no instances of Internet Explorer are running, one is started with the given URL.

How can I write similar scripts for other browsers like Firefox or Chrome? OS neutrality is nice, but not necessary. I'm running cygwin bash on Windows Vista and Windows 8. I'm not sure where to start!

I'm hoping these browsers have an API for enumerating all the instance running and an API function for sending a URL to an existing instance of the browser. Has anyone already done this? I hope so!
thanks
siegfried

firefox -help