Pikoh Asked: 2020-07-28 05:34:07 +0800 CST 2020-07-28 05:34:07 +0800 CST 2020-07-28 05:34:07 +0800 CST How to start applications of various types from another application? 772 In .net there are several types of applications/installation modes. How can another .Net application be executed from one meeting these criteria? c# 1 Answers Voted Best Answer Pikoh 2020-07-28T05:34:07+08:002020-07-28T05:34:07+08:00 Start applications knowing their route The main way to run one application from another is to use Process.Start. For example, the following code opens an instance of Chrome: System.Diagnostics.Process.Start("chrome.exe"); In this case you don't need the path, since it is in the path. If not, you can put the full path to the executable: System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"); If you need to pass parameters to it, you can do that as well: System.Diagnostics.Process.Start("chrome.exe", "--incognito"); Launch installed applications using Click Once To run applications launched via Click Once there are several options: If the application was installed from a URL (on a local network, for example), it can be run using Iexplore.exethe URL of the file .applicationas a parameter: Process.Start("Iexplore.exe", "http://miServidor/aplicacion/aplicacion.application"); With this option, if the application is not installed, it will automatically skip its setup. Another option is to search for the appref-mscorresponding file, knowing the start menu folder where it is located. Something like that: StringBuilder sb = new StringBuilder(); sb.Append(Environment.GetFolderPath(Environment.SpecialFolder.Programs)); sb.Append("\\"); sb.Append("CarpetaEnElMenuInicio"); sb.Append("\\"); sb.Append("MiAplicacion.appref-ms"); string shortcutPath = sb.ToString(); System.Diagnostics.Process.Start(shortcutPath); Launch UWP apps Starting UWP apps is a bit more complex. Automate the startup of Windows 10 UWP apps for a few options. One is the following: Get the Package Family Name of the application to run (you can get it by opening a PowerShell and running get-appxpackage MiNombreDePaquete) Run your app using app appxlauncher.exe: C:\Program Files (x86)\Windows Kits\10\App Certification Kit\microsoft.windows.softwarelogo.appxlauncher.exe" MiNombreDePaquete_ph1m9x8skttmg!AppId There are other options that you can consult in the link added above.
Start applications knowing their route
The main way to run one application from another is to use
Process.Start
. For example, the following code opens an instance of Chrome:In this case you don't need the path, since it is in the path. If not, you can put the full path to the executable:
If you need to pass parameters to it, you can do that as well:
Launch installed applications using Click Once
To run applications launched via Click Once there are several options:
If the application was installed from a URL (on a local network, for example), it can be run using
Iexplore.exe
the URL of the file.application
as a parameter:With this option, if the application is not installed, it will automatically skip its setup.
Another option is to search for the
appref-ms
corresponding file, knowing the start menu folder where it is located. Something like that:Launch UWP apps
Starting UWP apps is a bit more complex. Automate the startup of Windows 10 UWP apps for a few options. One is the following:
Get the Package Family Name of the application to run (you can get it by opening a PowerShell and running
get-appxpackage MiNombreDePaquete
)Run your app using app
appxlauncher.exe
:There are other options that you can consult in the link added above.