I was trying to edit the HOSTS file on Windows Server 2008 with Notepad++ but after editing it wouldn't let me save it with a "Save failed" - "Please check whether if this file is opened in another program" (the ...whether if... is their message not my typo).
Anyhow, didn't turn out to be read-only as I initially thought or another process as suggested (I did try stopping several services to see if that would help) but instead it turned out to be the fact that I hadn't started Notepad++ as administrator.
I don't understand why I need to run Notepad++ as administrator to edit the HOSTS file but aparently I do. I'm sure that it's just a matter of getting used to this new Vista style UAC that I assume is the underpinning of the security model in Server 2008.
To run Notepad++ (or any other program) as an administrator just right click on the application and select "Run As Administrator."
Mozey: Right click notepad or notepad++ and on the menu you'll see an option to "run as administrator"ReplyDelete
Yeah stupid trick. I like the linux way. sudo notepad++. Here I have to change the shortcut and now ... I can overwrite anything. And thank you Microsoft for VERY clear error messages... NOTReplyDelete
I've followed this entry up with my reasons why you should disable UAC: guyellisrocks.com/.../disable-uac-on-ReplyDelete
hey can i edit the host file on server 2008 n make all the peers on the LAN reference it instead of DNS server....?ReplyDelete
To be honest i am glad they did this other wise anyone could edit the files by mistake-dont know why your being hard on MS when they did something right?RIght clicking admin is easier than going into the terminal and typing sudo any day so i dont know what the problem is?ReplyDelete
Thank you, very helpful.ReplyDelete
This helped me so much... Thank you!!!ReplyDelete
I'm a student trying to get my working environment going with Netbeans for JSP.
It may be a problem with who owns the file or rwx persmissionsReplyDelete
Thanks! This post was extremely helpful.ReplyDelete
Saved me a lot of troubleshooting! :-)ReplyDelete
p.s. happens in Windows 7 as well.ReplyDelete
Right click on command prompt and run as administrator. Anything launched from the command prompt will be with administrative permissions. Then type "notepad" and hit enter. Ctrl-O and browse to hosts file, change notepad drop down from "Text Documents" to "All Files". Edit, save.ReplyDelete
This fix really rocked and saved my time this Sunday.ReplyDelete
thankyou very much! very very helpfulIReplyDelete
Thanks a lot, This worked!ReplyDelete
I don't understand why this is necessary but it did work like a charm. Thanks for the tip, Guy!ReplyDelete
I didn't find that in the menu in Win7 EE, but I worked it out through this way:ReplyDelete
and change the attributes in "Permissions for Authenticated Users".
Thank you very much.
Thank you for this! You came up quickly via googling "edit hosts file read only" and this was exactly the solution I needed. Editing with UltraEdit in Windows 7.ReplyDelete
Hi, This doesn't work for me. When I navigate to the apphost.xml through NotePad++, the file I needs doesn't show. Even though it's set to display all files.ReplyDelete