Have you ever tried to edit a file in a protected windows directory such as C:Program Files? If your experience was anything like mine, it was an incredibly frustrating experience! In my case, I was experiencing warning messages in the Event Viewer logs resulting from an issue with Exchange Server 2013, and the solution involved editing some XML configuration files to get rid of an unnecessary entry. The instructions were simple – go to the directory, edit the files, and your problem should be solved.
However, when I tried to do as instructed, I realised that I couldn’t save my edits because the files were within C:Program Files and Windows protects the contents of these folders. When I did a Google search for a solution, the most common answer I could find was to run Windows Explorer with elevated privileges when browsing to the files – but I still haven’t found out how to actually do that on Windows Server 2012! (I did find a solution for Windows Server 2008, but it was pretty messy – I prefer my solution.)
It turns out that, once you understand the problem, the solution is pretty simple.
Here’s the solution to edit a file in a protected Windows directory:
- Open a ‘Command Prompt’ with elevated permissions (i.e. Go to your Start Menu, type ‘CMD’, and when the Command Prompt shows up in the menu, Right-click it and ‘Run as Administrator’.)
- Using your command prompt, go to the directory containing the file you need to elevate (this involves the old DOS-style commands of cd to change directory, etc…)
- Once in the correct directory, type ‘notepad filename.xml’ and press enter – this will launch your file in Notepad, but from within the context of your elevated privileges. Now, when you’re finished you’ll be able to save your file.
I hope this helps a few people – it certainly took me a little while to find the work around for this problem!Tags: command prompt, elevated, privileges