我怎么可以运行一个应用程序重新启动后自动? [英] how can I run an app automatic after restart?

查看:130
本文介绍了我怎么可以运行一个应用程序重新启动后自动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么可以运行一个应用程序重新启动后自动?
(由C#代码)我创造的RunOnce注册表中的应用程序的路径键的新字符串。
操作系统将其加载操作系统
我的问题之前运行这个程序是:我的应用程序加载,但探险不加载后,我关闭我的应用程序,资源管理器加载
我重新启动APP计算机,并重新启动后,我想我的应用程序重新打开

how can I run an app automatic after restart? (by c# code) I create A new string in 'runOnce' key in registry with the path of the App. the OS run this APP before it load the OS my problem is: My APP loads but explorer doesn't load, after I close my APP, explorer loads I restart the computer in APP, and after restart I want that my APP reopen

推荐答案

当您从您的应用程序单击重新启动,进行以下修改注册表

When you click restart from your app, make the following modifications to the registry:

创建 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 条目注册表分支。

使用

Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\YourAppName");

要创建一个条目。

RegistryKey myKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\YourAppName", true);

myKey.SetValue("YourAppName", "AppExecutablePath", RegistryValueKind.String);



设置运行路径。

to set the run path.

之后,系统重新启动,你的应用程序启动并通过调用该删除启动项:

After the system has restarted, your app starts and removes the restart entry by calling this:

Registry.LocalMachine.DeleteSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\YourAppName");

这篇关于我怎么可以运行一个应用程序重新启动后自动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆