Multiple Instances of Apps

How to Setup Rossware Utilities for Multiple Unique Instances

In regard to utilities like the EmailedDispatchReceiver and SB-DispatchLink, some users find themselves wanting to run multiple instances, each setup to work with a different background entity and/or account. Absent solution otherwise, it creates an issue if you wish to have each such instance running from the same desktop. The reason is because each instance will normally save its settings to the same location. Thus, if you setup for one instance with a particular configuration, then setup another instance configured differently, the second instance’s settings will overwrite what was saved for the first instance.

There is a simple solution to this problem.

Windows has a little internal function whereby, when any application is started, Windows is willing to pass to the application what is called a “Command Line Argument.” We take advantage of this function.

Specifically, you will configure so that as each of your multiple instances is started, Windows simultaneously passes to it what is a unique-to-that instance string of characters. Based on receiving this string from Windows as it starts, the application knows to save and read its settings in a place that’s unique — on specific basis of that string.

To do this setup is very easy. You can use either of two methods:

Method 1: Use Multiple Modified Windows Desktop Shortcuts

You likely already know how to create a Windows desktop shortcut. With this method, you'll simply create a separate shortcut for each instance of an application that you wish to run multiple unique instances of. In regard to each such shortcut, you'll open its Properties window (right-click on the shortcut and select "Properties"). In the box that's labeled "Target," you'll simply add an expression (whatever expression you wish) that uniquely identifies the instance of the application it is that you want this shortcut to start:

Quite simply, this little addition of text is what's passed by Windows to the application as its Command Line Argument.

Method 2: Make a Single Batch-File to Start all of Your Unique Instances and of Multiple Applications

If you're wanting to have multiple instances of multiple different applications, it could potentially make for a lot of different desktop shortcuts. If so, it might be a little cleaner and easier to use this method.

Start by opening Notepad (you can click on Windows Start and begin typing “Notepad” to find it). In Notepad, type a single line of text for each instance of any such application that you wish to run multiple instances on. Each line begins with the word “START”. Following is the filespec for the application itself. Then is the unique string you want to use to identify each particular instance (it's what's passed by Windows to the app as its command-line-argument when Windows starts the app). For example, your text might look something like this:

  • START z:\sd\SB-DispatchLink.exe ForAccnt541892 
  • START z:\sd\SB-DispatchLink.exe ForAccnt981858 
  • START z:\sd\SB-DispatchLink.exe ForAccnt088181 
  • START z:\sd\EmailedDispatchReceiver.exe ForAHS 
  • START z:\sd\EmailedDispatchReceiver.exe ForCHW

Now all you must do is save your text in what’s called a “batch file.” To save as a batch file is darned easy. All you must do is pick any name and location you want, but give it a “.bat” extension. Thus (and as an example), you might save to your desktop under the name “StartMyMultipleInstanceApps.bat”.

Now, all you must do is double-click on that file, to run it. It will instantly start each of the instances as described in each line, passing the unique string to each instance. Each instance will see that unique string as passed to it, and will know to save and read its settings accordingly.

To assure all of these starts occur automatically as Windows is periodically rebooted, place a shortcut to this batch file in the Windows Startup folder. It’s that simple.

If, BTW, you need help in creating and setting up this file, our support staff will be delighted to assist.

As of November 2018, we have placed this capability into SDML, EDR, SBDL, SPDL and SSDL. If you need the capability in other apps, please let us know.