- 1 year ago
URL Scheme with argument in windows
In Windows, you can create a custom URL scheme with arguments by following these steps:
Choose a unique URL scheme name: Select a unique name for your custom URL scheme. For example, you can use
myapp
.Register the URL scheme: To register the URL scheme on the system, you need to modify the Windows Registry. Open the Registry Editor by pressing Win + R, typing
regedit
, and pressing Enter.Navigate to the appropriate registry key: Go to the following registry key:
HKEY_CLASSES_ROOT\myapp
Create a new key under the URL scheme name: Right-click on the
myapp
key, select "New," and then choose "Key". Name the new key asshell
.Create a new subkey under the
shell
key: Right-click on theshell
key, select "New," and then choose "Key". Name the new key asopen
.Set the default value of the
open
subkey: Double-click on the(Default)
value in the right-hand pane and set its value to the display name of your application. For example, you can set it to "My App".Create a new key under the
open
subkey: Right-click on theopen
key, select "New," and then choose "Key". Name the new key ascommand
.Set the default value of the
command
subkey: Double-click on the(Default)
value in the right-hand pane and set its value to the path of your application executable followed by the arguments placeholder%1
. For example, if your application executable is located atC:\Path\To\MyApp.exe
, the value would be:perl"C:\Path\To\MyApp.exe" "%1"
Note that the
%1
placeholder represents the argument passed to your application.Save the changes: Close the Registry Editor.
Test the URL scheme: You can now test the URL scheme by opening a web browser or another application and entering a URL using your custom scheme, followed by the argument. For example:
arduinomyapp://some-argument
The browser or application should attempt to launch your application with the provided argument.
By following these steps, you can create a custom URL scheme with arguments in Windows and configure it to launch your application.