zoukankan      html  css  js  c++  java
  • 关于操作注册表

    呃,做这个的思路呢,一切的源头,但是因为我懒。。。

    每天开机,要打开工作网站vso,还要打开vs,sql,邮箱。。。。

    每天重复,乐此不疲(其实已经很疲了)

    所以,忽然想到这些东西能不能在我开机后自动启动呢。。?

    最一开始想到了bat,写了一个服务+运行bat文件,发现运行后没有结果。。。

    what fuck 。。

    于是在这茫茫网络大海,看到了注册表。

    于是,讲bat文件里的路径拷贝到了注册表里的Run。

    奇迹出现了,妈妈再也不用担心我每天开机启动这些东西了。

    假如就像vs。。

    "C:Program Files (x86)Microsoft Visual Studio2017ProfessionalCommon7IDEdevenv.exe"
    

    浏览器打开默认网址

    "C:Program Files (x86)GoogleChromeApplicationchrome.exe" --user-data-dir="%APPDATA%GoogleChromeUser Data" --disk-cache-dir="%LocalAppData%GoogleChromeUser Data" http://www.baidu.com
    

    可是我很懒,这样岂不是每次换电脑都要找那密密麻麻的注册表。。

    于是我写了个程序去操作注册表。。

     var sofName = this.txturl.Text.Trim();
                //创建
                RegistryKey key = Registry.LocalMachine;
                RegistryKey software = key.CreateSubKey(sofName);
                //该项必须已存在
                RegistryKey opensoftware = key.OpenSubKey(sofName, true);
    
                opensoftware.SetValue(this.txtName.Text.Trim(), this.textBox3.Text.Trim());
                opensoftware.Close();
                key.Close();
    
                MessageBox.Show("创建成功!");
    

    然后修改注册表值

      var sofName = this.txturl.Text.Trim();
                RegistryKey key = Registry.LocalMachine;
                //该项必须已存在
                RegistryKey opensoftware = key.OpenSubKey(sofName, true);
    
                opensoftware.SetValue(this.txtName.Text.Trim(), this.textBox3.Text.Trim());
                opensoftware.Close();
                MessageBox.Show("修改成功!");
    

    当然得有删除

     var sofName = this.txturl.Text.Trim();
                RegistryKey delKey = Registry.LocalMachine.OpenSubKey(sofName, true);
                delKey.DeleteValue(this.txtName.Text.Trim());
                delKey.Close();
                MessageBox.Show("删除成功!");
    

    当然必须得有读取。。

        var sofName = this.txturl.Text.Trim();
                string info = "";
                RegistryKey Key;
                Key = Registry.LocalMachine;
                var myreg = Key.OpenSubKey(sofName);
                // myreg = Key.OpenSubKey("software\test",true);
                info = myreg.GetValue(this.txtName.Text.Trim()).ToString();
                myreg.Close();
                this.textBox3.Text = info;
    

    嗯,我真的好懒,为了防止以后找代码,我还打了包。。

    安装文件下载地址:链接: https://pan.baidu.com/s/175lT7A-6suT9aan3GWMaNA 密码: 8z99

    源代码地址:链接: https://pan.baidu.com/s/1sWauhgF9qaes9xYdLCnfyQ 密码: zin3

    嗯,写这么多,好累。

    如果能干掉(绕过)杀毒软件就好了。

    杀毒软件还是会拦截的。

    唉。。。。。。。。。。。。

    如果有大神有这方面的知识,跪求赐教。。

    附一张图吧。。

    要不然看不懂。。。

  • 相关阅读:
    在 ASP.NET 2.0 中上载文件
    ASP.NET(C#)FileUpload实现上传限定类型和大小的文件到服务器<from Copying>
    aspnetupload 上传组件在VS2008中使用详细说明
    基于asp.net 的文件上传和下载~~~转
    设置竖直的分割符【使用div】 (根据屏幕的大小自适应)
    分隔线
    UGUI事件系统
    U3D音频系统
    Unity启动事件-监听:InitializeOnLoad
    VS生成桌面应用程序
  • 原文地址:https://www.cnblogs.com/myblogslh/p/9415650.html
Copyright © 2011-2022 走看看