When we type "Notepad" in "Windows > Run" the Notepad is launched.
In the same way, I would like to load my WPF window Application when a user types the program name in "Windows > RUN" or in command prompt(cmd).
What should I do to make this happen?
简单输入的原因notepad,并且您不需要输入完整路径C:\Windows\notepad是因为C:\Windows\它在PATH环境变量中。
因此,为了让 Windows 在您键入时能够找到您的程序myProgram,并且不需要您的用户键入C:\Program Files\myProgram\myProgram,程序的位置必须在PATH环境变量中。
要从安装程序中的代码执行此操作,请参阅如何在 C# 中获取和设置环境变量?.