Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from Dec 28 '12 at 13:33

This question came from our site for professional and enthusiast programmers.

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. – Karan Dec 28 '12 at 21:28
Similar one is answered here: – Kuldeep Jain Feb 25 '14 at 14:28

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.

share|improve this answer
can you backup your answer with some kind of source and/or other peoples' experiences about this issue? – Lorenzo Von Matterhorn Mar 29 '13 at 9:45
+1 for pointing out that it's UAC. I've seen this before. – MDT Guy 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. – trlkly Jun 1 '14 at 22:20

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.

share|improve this answer
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. – Jordan Gray 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. – Andrew Mallonee 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. – Jordan Gray 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. – Dominic Cronin Sep 16 '14 at 16:30

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))

share|improve this answer

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).

share|improve this answer

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.
share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

protected by Community Dec 18 '13 at 17:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?