Introduction
I developed this SingleRun application to address a business requirement. The requirement called for a method to allow only one instance of an application, taking arguments into account, when a user clicked on a shortcut.
In addition to this, when the application is already running, clicking on shortcut should bring the application into focus.
Although I frequently use the application, it is a bit of a niche solution so sharing it, hoping that someone will find it useful.
Implementation
Step 1) Download Visual Studio Project
https://bitbucket.org/svermaak/singlerun/downloads/ (Source Code)
https://github.com/svermaak/downloads/raw/main/SingleRun.zip (Binary)
Step 2) Save to a convenient location (C:\Program Files\SingleRun in this article)
Step 3) Create a SingleRun shortcut. You can create a SingleRun shortcut with by one of two ways:
Method 1) Drag and drop
Method 2) Command line
SingleRun supports the following command line arguments:
SingleRun.exe scope workingfolder target arguments
scope: Computer or User
workingfolder: Working folder to change context to
target: The path the application to star
arguments: Argument of the target
Demo execution
I hope you found this tutorial useful. You are encouraged to ask questions, report any bugs or make any other comments about it below.
