简体   繁体   English

C#错误Windows启动时,对路径'C:\\ Windows \\ system32 \\ Com \\ dmp'的访问被拒绝

[英]C# Error Access to the path 'C:\Windows\system32\Com\dmp' is denied When Windows Startup

thanks because you has been come to this post. 谢谢,因为你来过这个职位。 I have an error with my script, that log says: 我的脚本有错误,该日志显示:

Access to the path 'C:\\Windows\\system32\\Com\\dmp' is denied. 拒绝访问路径“ C:\\ Windows \\ system32 \\ Com \\ dmp”。

I want to set my application to windows startup , so when that computer client started, my software is automatically running. 我想将我的应用程序设置为Windows startup ,因此当该计算机客户端启动时,我的软件会自动运行。 So i put this script on my Main Load. 所以我把这个脚本放到我的主要负载上。

    private void Main_Load(object sender, EventArgs e)
    {
        //Menjadikan software ke dalam Startup Windows, sehingga dapat berjalan ketika pc pertama kali dinyalakan
        RegistryKey reg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
        reg.SetValue("PR Reminder", Application.ExecutablePath.ToString());
        listMapel();
        bool notif = Properties.Settings.Default.Notification;
        if (notif == true)
        {
            checkExpired(); //Mengecek tanggal penyerahan dan pemberian
        } 

The result is work. 结果就是工作。 But I'm getting an error like this. 但是我遇到这样的错误。

拒绝访问路径“ C:\\ Windows \\ system32 \\ Com \\ dmp”。

After explored more deeply, the center of the issue is the method listMapel(); 经过更深入的探讨之后,问题的中心是listMapel();方法。 where he was tasked to search for files ending in .db in the local directory. 他的任务是在本地目录中搜索以.db结尾的文件。

I dont know why this method is got error. 我不知道为什么这种方法会出错。 When i try to remove this method, my application running fine when startup. 当我尝试删除此方法时,我的应用程序在启动时运行良好。 I think the problem is on system.io. 我认为问题出在system.io上。

This is my listMapel(); 这是我的listMapel(); method script 方法脚本

    public void listMapel()
    {
        comboListMapel.Items.Clear();
        string path = Directory.GetCurrentDirectory(); //Lokal direktori
        string[] files = Directory.GetFiles(path, "*.db", SearchOption.AllDirectories);
        foreach (string file in files)
        {
            nama = file.Split(".".ToCharArray()); //Hasil result yang ditampilkan Matapelajaran.db (Tapi dengan ini kita mengambil string sebelum .db
            comboListMapel.Items.Add(Path.GetFileName(nama[0]));
        }
    }

You should always run as an administrator. 您应该始终以管理员身份运行。

Hope this helps link 希望这有助于链接

And another one 还有一个

授予对文件的访问权限,例如FileMode.Create,FileAccess.Write,FileShare。请不要尝试此操作,它可能会起作用。

暂无
暂无

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

相关问题 拒绝访问路径“ C:\\ Windows \\ System32 \\” - Access to the path 'C:\Windows\System32\ is denied 访问路径 'c:\windows\system32\inetsrv\config\' 被拒绝 - Access to the path 'c:\windows\system32\inetsrv\config\' is denied WebClient下载-“拒绝访问路径'c:\\\\ windows \\\\ system32 \\\\ inetsrv \\\\ MyPrintManager.exe'” - WebClient Download - “Access to the path 'c:\\windows\\system32\\inetsrv\\MyPrintManager.exe' is denied” EF6添加迁移失败-拒绝访问路径'C \\ WINDOWS \\ SYSTEM32 \\ MyContext.edmx' - EF6 add migration fails - Access to the path 'C\WINDOWS\SYSTEM32\MyContext.edmx' is denied GoogleWebAuthorizationBroker-拒绝访问路径'C:\\ Windows \\ system32 \\ config \\ systemprofile' - GoogleWebAuthorizationBroker - Access to the path 'C:\Windows\system32\config\systemprofile' is denied 如何在 C# 中获取 Windows\system32\config\systemprofile\AppData\Local\ 文件夹路径? - How to get Windows\system32\config\systemprofile\AppData\Local\ folder path in C#? c#winforms GetCurrentDirectory返回C:\\ WINDOWS \\ System32 \\设计错误 - c# winforms GetCurrentDirectory returns C:\WINDOWS\System32\ design error “访问路径'D:\\\\ Windows \\\\ system32 \\\\文件被拒绝”Azure Web App - “Access to the path 'D:\\Windows\\system32\\file is denied” Azure Web App 如何使用c#asp.net获取C:\\ Windows \\ System32 \\ inetsrv \\ config文件夹的访问控制 - How to get access control of C:\Windows\System32\inetsrv\config folder using c# asp.net .NET CORE 3 Windows 服务的基本路径返回 C:\Windows\System32,但实际文件夹为 D:\MyCustomService - .NET CORE 3 The base path of a Windows Service is returning C:\Windows\System32, But actual folder is D:\MyCustomService
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM