访问路径“test.exe”被拒绝。 [英] Access to the path "test.exe" is denied.

查看:113
本文介绍了访问路径“test.exe”被拒绝。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C#.net将一个文件从一个目录复制到另一个目录。示例



test.exe用于将当前文件夹中的文件复制到正在运行的文件夹

访问路径测试.exe被拒绝。错误将来......如何避免此错误

I have one copy a file from one directory to another directory using C#.net. Example

The test.exe is used to copy file in one folder to running folder at that time
"Access to the path "test.exe" is denied." error will come... how to avoid this error

推荐答案

您登录PC的用户(运行.exe文件的用户)需要读取和执行权限到exe文件所在的那个目录。
The user you logged in you PC(under which the .exe file will run) needs read & execute permission to that directory where the exe file exists.


可能是text.exe在任务管理器中打开看到进程是否打开

如果打开就写了下面的代码停止进程



may be text.exe is open in task manager see the process is open or not
if open you write the code below to stop the process

Process[] processes = Process.GetProcessesByName("test.exe");
if (processes.Length > 0)
    processes[0].CloseMainWindow();





然后编写代码以复制文件



and then write your code to copy the file


这篇关于访问路径“test.exe”被拒绝。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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