Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted

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.
 
Share this answer
 
Comments
boogac 25-Feb-13 4:19am    
5+
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

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


and then write your code to copy the file
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900