55

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.

Jens Erat
  • 18,485
  • 14
  • 68
  • 80

8 Answers8

92

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.

Johan
  • 921
  • 6
  • 3
14

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.

Psycogeek
  • 9,139
8

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

wonea
  • 1,877
3

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.

Thorsten Niehues
  • 1,881
  • 5
  • 25
  • 31
1

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.

rbhat
  • 521
1

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

KarSho
  • 137
1

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.

0

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.
Braiam
  • 4,777