c#实现程序自启动(修改注册表)

C#实现Windows开机自启动应用程序 上述代码通过打开当前用户的注册表项"SOFTWARE\Microsoft\Windows\CurrentVersion\Run",并将应用程序的路径添加到该项中,实现了开机自启动的设置。在本篇文章中,我将向您展示如何使用C#编写一个应用程序,以实现在Windows系统启动时自动启动该应用程序的功能。现在,当您的应用程序启动时,它将自动将自己添加到Windows注册表中的开机自启动项。请记住,当您的应用程序不再需要开机自启动时,您可以通过删除注册表中的相应项来禁用该功能。步骤 2: 引用必要的命名空间。 阅读详情

 

C#修改注册表实例俩则 去年年末才看过一本关于ASP.NET 操作注册表的书,可惜那时候就压根没想过写到网上去。 现在想想 写到网上有诸多好处 比如、 1、可以快速回忆相关知识点,还有自己写的参考代码,比别人写的强多了 2、可以丰富自己的博客推广自己 3、加强自己写作能力 贴出代码了 -------------------- 1、引入命名空间 using Microsoft.Win32;//修改注册表所需要用到的命名空间 2、之后方法喽 //修改注册表 设置IE打印背景图片 适用于IE8一下版本,修改为工具选项下的 打印背景颜色与图像 public void IESetupPrint_Background() { RegistryKey key = Registry.CurrentUser; RegistryKey software = key.OpenSubKey("Software\\Microsoft\\Internet Explorer\\Main", true); //该项必须已存在 software.SetValue("Print_Background", "yes"); software.Close(); } //设置页眉 页脚为空 public void IESetupPageSetup() { RegistryKey key = Registry.CurrentUser; RegistryKey software = key.OpenSubKey("Software\\Microsoft\\Internet Explorer\\PageSetup", true); //该项必须已存在 software.SetValue("header", ""); software.SetValue("footer", ""); software.Close(); } //设置页边距 设置IE页面设置 打印背景图片 //上下边距具体的值可以 先在IE里面设置再查看注册表实际值 然后在程序里写死 public void IESetupPage() { RegistryKey key = Registry.CurrentUser;//IE8以上版本 修改为页面设置 里页面 打印背景颜色与图像 RegistryKey software = key.OpenSubKey("Software\\Microsoft\\Internet Explorer\\PageSetup", true); software.SetValue("margin_top", 0.55984); software.SetValue("margin_bottom", 0.55984); software.SetValue("margin_left", 0.75433); software.SetValue("margin_right", 0.40000); software.SetValue("Print_Background", "yes"); } //查看注册表相应的键值 运行输入 regedit 立即下载

相关推荐

C# 操作注册表 API

Api接口,调用相关的入口函数,获取相应的注册表中的要查询的结果

如何设置Windows 7使用域账号自动登录

背景 在很多应用场合(例如演示用PC)都需要设置Windows使用特定的账号自动登录。在Windows域中的PC缺省不允许设置自动登录,但是可以通过修改注册表的方式设置PC使用Windows域账号进行自动登录。   准备工作 建立注册表设置文件,例如文件autologon.reg,内容如下:   Windows Registry Editor Version 5.00   [HKE

spl6891的专栏 6673

C#操作注册表实现程序随系统开机自动启动

C#操作注册表实现程序随系统开机自动启动,需要.net 2.0支持,需要管理员权限才能操作注册表,支持xp系统; 在win7 win10下由于UAC权限问题仅支持不需要管理员权限的程序随系统自动启动。

设置开机自启动

void SetAutoRun(BOOL bAutoRun) { //设置开机自启动 HKEY hKey; LPCTSTR strRegPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";//找到系统的启动项 if (bAutoRun) { if (RegOpenKeyEx(HKEY_CURRENT_

、张念 631

C# 注册表 写入和读取

基于C#的注册表写入和读取数据,可用于数据的保存和读取,使用十分方便!

C#向注册表写入和读取数据

注册表存取操作!可以实现想计算机的注册表插入信息!

c#设置软件开机自动运行,修改注册表

#region /// <summary> /// 开机启动项 /// </summary> /// <param name="Started">是否启动</param> /// <param name="name">...

diehe5608的博客 182

基于c#开发的开机自启 (写入注册表)

基于c#的 开机自启程序 亲测可用,运行后在杀毒软件里可以查到。如有特殊需求请留言。持续为您更新中。using Microsoft.Win32;

开机自启动——修改注册表

因为项目中需要用到设置程序为开机自启动的,就在代码中修改注册表的方式来做的。 但是在做的过程中出现一些问题,在查阅资料后,进行了一些总结。 一、代码 直接使用C#代码操作注册表,注册为开机启动项。 RegistryKey Local = Registry.LocalMachine; RegistryKey runKey = Local.CreateSubKey(@"S...

weixin_30333885的博客 444

校园网改造实录:手把手教你用华为MA5800 OLT调试全光网(附常用排错命令)

本文详细记录了校园全光网改造中华为MA5800 OLT的部署与调试过程,涵盖设备选型、基础配置、ONU批量部署及高频故障排查。通过实战案例和排错命令,帮助网络工程师快速掌握全光网调试技巧,实现低延迟、高稳定的网络性能。

weixin_42552716的博客 573

c转c++——蓝桥杯

在这里,`int &i` 表示 `i` 是一个整型的引用变量,而不是一个拷贝,这意味着在循环中对 `i` 的修改会影响到数组 `arr` 中对应位置的值。arr则是需要遍历的数组。一、为啥要转C++:之前只学过C语言,然后为了蓝桥杯苦哈哈敲了C好久,偶然听了别人的意见去看了一下C++后发现简直太香了——C++不像C要把底层逻辑自己敲出来,而是可以直接调用STL函数库(比如排序,C语言可能要敲个几十行代码C++直接用调用sort函数就可以了),而且C++完全兼容C语言,里面的语法全部可以用C替换。

smwymzqbyl的博客 2045

C# 实现程序开机自启动、读取注册表的exe路径

做一个检测程序,但不想每次开机手动的方式去打开程序,方法可以把你要开启的程序写进注册表,这样电脑启动后会自动读取注册表信息现实开机自启动。废话不多说,直接看代码 /// &lt;summary&gt; /// 开机自启动 /// &lt;/summary&gt; private void WriteRegistry() { ...

qq_42335551的博客 1344

2025年VSCode AI插件实战:如何用Devika+Continue+Tabby三件套10倍提升开发效率

本文详细介绍了2025年VSCode AI插件Devika、Continue和Tabby的三件套组合,如何通过智能开发工作流10倍提升开发效率。从项目架构生成到上下文感知辅助,再到本地化智能编码,这套方案实现了从需求分析到代码生成的全流程自动化,特别适合中大型项目开发。

weixin_26911099的博客 270

C# 设置应用程序开机自启动

注册表中设置开机自启动: link. 将当前应用程序的应用程序文件添加到注册表中,实现开机自启动 using Microsoft.Win32; using System; namespace TestAutoRun { class Program { static void Main(string[] args) { ...

MelanceXin的博客 3143

如何解决ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE.

解决ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE

2742

宽带阻抗匹配的工程实现-第一步,端口驻波仿真

其实阻抗匹配我工作以来经常说,也经常做,但是基本上都是直接在印制板上进行调试。现在想先用仿真软件直接设计出来,才发现很多东西嘴上说容易,想做出来太难了。所以准备写一些文章,记录一下碰到的问题。

pp_0604的博客 2376

C# 设置程序开机自启动

设置启动 //设置开机自启动 string path = Application.ExecutablePath; RegistryKey rk = Registry.LocalMachine; RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"); rk2....

dianzhuique8587的博客 169

2026年算法工程师常见面试简答题

本文摘要:文章系统梳理了机器学习与深度学习中的30个核心概念,涵盖模型优化、评估指标、经典算法和大模型应用等关键知识点。主要内容包括:1)过拟合与欠拟合的成因及解决方法;2)偏差-方差权衡原理;3)数据划分与交叉验证策略;4)分类/回归任务评估指标选择;5)逻辑回归、决策树、SVM等传统算法解析;6)梯度下降优化与正则化技术;7)CNN、RNN、Transformer架构对比;8)Embedding表示与RAG技术。特别强调面试高频考点如XGBoost改进、注意力机制原理等,并给出实际工程中的解决方案建议,

不务正业的猿 350

C#:开机自启动

通过RegistryKey类,直接修改注册表。

genghao的专栏 174

实测可复现|2026 Cloudflare盾v4.0反反爬全实战:从JS/WASM逆向到JA3指纹伪装,手把手突破拦截(附完整逆向代码+避坑手册)

本文以2026年Cloudflare盾v4.0(集成Shield Synapse v2.0)为核心,全程以实战复盘为视角,拆解了从JS/WASM混合逆向、全维度指纹伪装(JA3+浏览器指纹)、人类行为模拟,到代理池搭建的全流程,整合了完整可复现的代码,所有步骤和踩坑点均为实测所得,无任何AI套话,新手也能跟着复现,最终实现爬取成功率从12%提升至95%+。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1686

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

c#让一个程序开机启动【通过改注册表的方式】

private void button1_Click(object sender, EventArgs e) { RunWhenStart(false, "mystarton", @"C:/Program Files/UltraEdit/Uedit32.exe"); } /// /// 开机启动项 /// /// 是否启动

ZHENNIUBILE的专栏 1386

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

C# 设置开机自启动

1、创建一个winfrom工程button1(设置开机自启)button2(取消开机自启)using Microsoft.Win32; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.L...

你要明白,任何问题都不是孤立存在的,一定有人曾经遇到过,并且已经有更好的解决办法了,只是我还不知道。我不应该在黑暗中独自前行,去重新发明轮子,也许我的顿悟,只是别人的基本功!我应该要站在巨人的肩膀上,学习更成熟的经验和方法,然后再来解决这个问题 3926

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

c#实现开机自动启动,以及解决修改注册表权限不足

开机启动方法:       #region       ///&lt;summary&gt;       /// 开机启动项       ///&lt;/summary&gt;       /// &lt;paramname="Started"&gt;是否启动&lt;/param&gt;       /// &lt;paramname="name"&gt;启动值的名称&lt;/pa

CS了个DN 1652

C#开机自动启动应用程序

//命名空间 using Microsoft.Win32; private void checkBox2_CheckedChanged(object sender, System.EventArgs e) { if (checkBox2.Checked) //设置开机自启动 { //MessageBox.Show ("设置开机自启动需要修改注册表","提示"); string path = A

wuhz520的专栏 563
上一篇: css 嵌入字体
下一篇: datagridview导出excel
york_software
博客等级 码龄18年 2粉丝 22原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值