# Write to Text File - process cannot access the file

**URL:** https://www.finalbuilder.com/forums/t/write-to-text-file-process-cannot-access-the-file/2124
**Category:** Discussion
**Created:** [April 19, 2013, 6:40am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-process-cannot-access-the-file/2124 "2013-04-19T06:40:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [April 19, 2013, 6:40am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-process-cannot-access-the-file/2124/1 "2013-04-19T06:40:35Z")

</div>

Hi Team,

I have using evaluation copy of Final Builder 6.3.0.2253. &nbsp;I am having a problem in writing to a text file.&nbsp;

My action flow is as follows.

Main Action --\> [do some action] --\> Write to text file [D:\Details.txt] (file created and written) --\> [do some action] --\>&nbsp;Write to text file [D:\Details.txt] --\> build fails

The error message is as follows

Cannot open file "D:\Details.txt". The process cannot access the file because it is being used by another process.

Why do I get this? I have checked and there is no other application using that text file. I have also rebooted my machine and did run a fresh build and still build fails because of the same issue.&nbsp;

Is final builder running the first process of writing in the text file till the second one ?

If so, should I close or kill the process and If so, how can I close or kill the process ?

Thanks,

Venkat

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [April 19, 2013, 6:42am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-process-cannot-access-the-file/2124/2 "2013-04-19T06:42:04Z")

</div>

Also I have tried running Final Builder as Administrator.   
  
 Thanks,   
 Venkat

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [April 19, 2013, 7:39am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-process-cannot-access-the-file/2124/3 "2013-04-19T07:39:54Z")

</div>

Hi,   
 I have checked the process and I found that after writing in the text file for the first time, I am **mailing the text file through send email action**. Then I am again writing in the text file. The issue occurs here.   
  
  **Why is that so ?**    
  
 Thanks,   
 Venkat

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [April 19, 2013, 12:49pm UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-process-cannot-access-the-file/2124/4 "2013-04-19T12:49:49Z")

</div>

Try adding a delay action after the email action, is possible the email library we use is slow to release the file.

---

<div class="post-metadata">

### Author: ![deidre.east](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/7ea924/32.png) [@deidre.east](https://www.finalbuilder.com/forums/u/deidre.east)
#### Post date: [October 16, 2013, 6:42am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-process-cannot-access-the-file/2124/5 "2013-10-16T06:42:24Z")

</div>

I am also getting this error. &nbsp;

**Errors&nbsp; : Error writing to text file:**

**Cannot open file "\\\.txt". The process cannot access the file because it is being used by another process**

In my situation, FinalBuilder Server was running a FinalBuilder script on the server where the file was being written. &nbsp;I was monitoring the log file from a Windows 7 laptop using Notepad++. &nbsp;When I ran the project again, without accessing it in Notepad++ on the Win 7 laptop, it ran fine. &nbsp;When I open the text files in Notepad++ on the build server using Notepad++, it is fine; Notepad++ doesn't lock it. &nbsp;I am in the process of looking at Win7 and Notepad++ for the culprit, but I thought I would mention this in case there are any suggestions on the FB action side of things that I overlooked.

Notepad++: &nbsp;v6.5

Window 7 laptop

Windows 2008 Server

FinalBuilder 7.0.0.2520

FinalBuilder Server&nbsp;7.0.0.350

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [October 17, 2013, 6:14am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-process-cannot-access-the-file/2124/6 "2013-10-17T06:14:59Z")

</div>

Unfortunately there’s not much we can do if the file is locked. I suspect that windows does the file locking automatically when accessing it over a network. Test using plain old notepad, that will give you an idea if it’s windows or notepad++ locking the file (my money is on windows).
