简体   繁体   English

使用ClickOnce应用程序创建启动文件夹shorcut?

[英]Creating a startup folder shorcut with a ClickOnce application?

I have created a ClickOnce application, available offline and can be reached through the start menu. 我创建了一个ClickOnce应用程序,可以离线使用,可以通过开始菜单访问。

However, is it possible to set this application to launch on startup/set a shortcut in startup folder through code or settings rather than creating some sort of batch file to do it for me? 但是,是否可以将此应用程序设置为在启动时启动/通过代码或设置在启动文件夹中设置快捷方式,而不是创建某种批处理文件来为我执行此操作? ClickOnce options seem to be really limited! ClickOnce选项似乎非常有限!

You can found the answer to your question in here, Run ClickOnce app on startup 您可以在此处找到问题的答案, 在启动时运行ClickOnce应用程序

You can also use startup registry key to launch your application. 您还可以使用启动注册表项来启动您的应用程序。

It is very simple to setup a key to launch a ClickOnce application and does not require setting up additional shortcuts. 设置密钥以启动ClickOnce应用程序非常简单,并且不需要设置其他快捷方式。 You simply use the shortcut created on install: 您只需使用在安装时创建的快捷方式:

// The path to the key where Windows looks for startup applications
RegistryKey rk = Registry.CurrentUser.OpenSubKey(
                    @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);

//Path to launch shortcut
string startPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs) 
                   + @"\YourPublisher\YourSuite\YourProduct";

rk.SetValue("YourProduct", startPath);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM