# Notepad++ says "Check if file is open in another program" - but no other program is open

I am trying to edit a .CFG file in Notepad++. When I try to save it, it shows an error:

Check if file is open in another program.


Previously, I have had no problem editing the configuration files or with saving my changes. To fix this problem, I have tried closing all other open windows, restarting Notepad++, and restarting my computer. Unfortunately, none of this allowes me to edit the file.

• See if you can copy the file elsewhere, edit, then overwrite the original. If not, use Process Explorer or a program similar to Unlocker to figure out what's locked the file. Dec 28 '12 at 21:28
• Similar one is answered here: stackoverflow.com/q/2763067/948268 Feb 25 '14 at 14:28
• Mine was Zone Alarm locking the hosts file, one of it's advanced settings. See here: superuser.com/a/1104284/145568
– Arth
Jun 21 '18 at 9:37

Had the same problem when setting up apache webserver and php. Found out that this is due to the UAC in windows 7. It's is not because you have the file open anywhere else. Try opening Notepad++ as administrator. Either right click Notepad++ shortcut and choose run as admin or ctrl+shift and click notepad++ shortcut. Then open the file you want to edit from within notepad++.

This solved the problem for me.

• +1 for pointing out that it's UAC. I've seen this before. Dec 18 '13 at 16:21
• The more standard way to handle UAC problems like this on a single file basis is to go ahead and save the file to somewhere else, like the Desktop, and then drag and drop the file to the proper directory (as Explorer can auto-elevate). This is what Microsoft recommends, for example. Opening as administrator is probably better reserved for when you need to save multiple files or save multiple times. Jun 1 '14 at 22:20
• @LorenzoVonMatterhorn, I just did what Johan said an it worked, so you now have another source. Nice username =). Jun 24 '16 at 0:09
• doesn't help (only sometimes) Aug 1 '17 at 8:25

One possible problem is that the file is open via the explorer Preview pane, select a different file in the preview pane or disable the preview pane completly.

I just had this issue and it was due to having the file selected inside of Windows Explorer - the directory browser. It shows a preview of the file and I guess that causes Notepad++ to see it as being open.

• Confirmed repro—on unselecting the file in Windows Explorer, the file could be opened again. Not the only cause of this error, but worth checking. Dec 18 '13 at 15:59
• This is not just I Notepad++ thing either. It seems just having the file selected in Windows Explorer marks the file as opened and can not be saved. Jan 21 '14 at 15:05
• Yup, it's pretty perverse that Windows Explorer's preview pane can lock files. Really counter-intuitive, very confusing and so easy to fall foul of. Jan 21 '14 at 22:57
• It's inconsistent. Somet.imes it locks, and sometimes not, but closing the preview gets rid of the problem. Sep 16 '14 at 16:30
• Does this still occur in W10? Feb 8 '17 at 17:59

Sysinternal's Process Explorer will allow you (amon many other neat things) to find out all the processes accessing a given path. To do this, once Process Explorer is started, press CTRL+F (or open menu Find - Find Handle), and then type the relevant path (ex: c:\some\path\to\file.cfg), and it will show you which process have this opened.

Usefull, for example, to find which process is accessing a drive you try to unmount: just search for x: and it will show you every process accessing drive x: (or it's subpath))

Avira (Free) Antivirus also blocks the modification of some files

e.g. C:\Windows\System32\drivers\etc\hosts

if you have Avira Antivirus try to disable "Real Time Protection" and try again.

permission of admin (Operating System User), as been blocked. So log-in as admin and give share permission to anther user(where you want to edit).

Its Kaspersky doing its stuff. The solution is by adding Notepad++ to Trusted group.
Actually , Kaspersky is supposed to report/popup message whenever it blocks program but in this case it doesn't.

I had the same issue trying to delete a .html file.

I had "Preview pane" ON in Windows Explorer (Windows 10) and the file was selected, which meant it was being previewed as html in "Preview Pane". So I kept getting the error when trying to delete it.

As soon as I unselected "Preview Pane" (under View tab) I was able to delete it.

It could be several causes:

• Another program has opened the file. But in your case this do not apply since you already restarted the system.
• You don't have permissions to access the file. Try moving it somewhere, or "Save as..." then replace the original with the new one.
• You shouldn't been touching the file. If you are trying to edit something in \Windows, is probable that the warning means that you really shouldn't touch that.