Cannot navigate to Windows/System32/drivers/etc

  • I’d like to edit the hosts file to add a static hostname to the table. Alas, Notepad++ can navigate only to C:\Windows\System32\drivers and then does not list the “etc” directory located there. Running as adminstrator doesn’t seem to change this.

    I can cheat and open “etc/hosts”, but it would be nice to be able to actually navigate into the etc folder. Any way to be able to do this?

  • @Lee-Butler said:

    does not list the “etc” directory located there

    Welcome Lee to the Notepad++ community

    I’d say this isn’t a Notepad++ issue. It may be that if you cannot see that folder it is because you have it hidden. Admittedly on both my Win7 and Win10 PC’s that folder is NOT hidden but anyone can hide it if they wish. As an example if you were to go to your profile (Win7 is C:\Users"profile name", Win10 should be the same) you should NOT see a folder called AppData, nonetheless it is there, albeit hidden. To prove it, in the FIle Explorer interface type %appdata% in the top line and press enter. You should now be under the AppData folder in another called Roaming, this is where some Notepad++ configurations can be held.

    You can change the visibility of folders such as these by using the folder option (Control Panel) and clicking on the View Tab. Change “Hidden files and folders” under Advanced Settings.


  • @Lee-Butler

    It seems like you are using a 32 bit version of Notepad++ on a 64 bit OS. That’s the reason why you can not use the path C:\Windows\System32\drivers\etc\hosts. Instead you have to use C:\Windows\SysNative\drivers\etc\hosts.


    Windows 64 bit uses directory and registry virtualization for 32 bit processes. For a 32 bit process C:\Windows\System32 actually points to C:\Windows\SysWOW64 whose drivers subdirectory doesn’t contain an etc directory. SysNative is a folder redirection only working for 32 bit processes which points to the C:\Windows\System32 directory.

    You can read an extensive explanation here.

  • @Lee-Butler I have everything perfectly opened and edited.
    Windows 7 х64


  • @andrecool-68 said:

    I have everything perfectly opened and edited.

    I guess that’s because you are using a 64 bit version of Notepad++.

  • @dinkumoil
    It does not matter … I can edit in any text editor x32 or x64
    Maybe the whole problem … is he not amine on this computer ?!

  • @andrecool-68 said:

    It does not matter … I can edit in any text editor x32 or x64

    Please note: The problem is not to edit the hosts file by dragging it from an Explorer window to an editor. The issue is about to open the hosts file by using (menu) File -> Open and selecting it from the Windows file selector dialog. If you do that from a 32 bit process you can navigate to C:\Windows\System32\drivers but you are actually in C:\Windows\SysWOW64\drivers where you are not able to find an etc directory.

    @andrecool-68 said:

    Maybe the whole problem … is he not amine on this computer ?!

    Admin or not doesn’t matter, this issue derives from directory redirection for 32 bit processes on 64 bit Windows OS.

    Have you read the explanation I’ve already linked to above? This text also contains a link to a Microsoft page where it is explained even in more detail.

  • @dinkumoil
    I don’t understand this scam to get to C:\Windows\SysWOW64\drivers and edit something … which shouldn’t be edited at all!
    Do you want to hack the operating system?
    The author… and fools everyone!

  • @andrecool-68 said:

    I don’t understand this scam to get to C:\Windows\SysWOW64\drivers and edit something

    There is nothing to edit, that’s the problem.

    @andrecool-68 said:

    Do you want to hack the operating system?

    No, I want to point out a method to navigate to C:\Windows\System32\drivers\etc from within a 32 bit application running on a 64 bit OS to load the hosts file.

    I think it would be the best to avoid further comments and to wait for the response of @Lee-Butler.

  • @dinkumoil Don’t wait for anything! All this is a silly idea!

  • @Lee-Butler

    I try to provide some possible solutions, as the things I wrote above might not be very helpful.

    As this is a complicated topic the truth is somewhere in the middle. As you already became aware of, it is not possible to navigate to C:\Windows\System32\drivers\etc directly by clicking on folder names in Windows file selector dialog because of Windows’ file system redirection for 32 bit processes running on a 64 bit OS. But it is possible to enter the path into the dialog’s address bar and it is possible to enter C:\Windows\System32\drivers\etc\hosts into its Filename input field. It is also possible to provide this path to Notepad++ per command line. The reason is that file system redirection is not done when the directory C:\Windows\System32\drivers\etc is explicitly referenced as a whole.

    Case 1: You want to open the hosts file by navigating to its directory using Notepad++ (menu) File -> Open

    You have to use the new style FileOpen dialog of Windows. To be able to do that go to (menu) Settings -> Preferences -> (register) Default Directory and check option Use new style dialog. Now go to File -> Open and enter C:\Windows\System32\drivers\etc to the address bar of the dialog (you can also use C:\Windows\SysNative\drivers\etc). You will see the hosts file, double-click on it to load it.

    Case 2: You have Explorer plugin installed and want to use its Favorites feature to create a shortcut to your hosts file

    When creating the shortcut provide C:\Windows\System32\drivers\etc\hosts as path to the file. You can also use C:\Windows\SysNative\drivers\etc\hosts.

    Case 3: You want a shortcut in the Run menu to your hosts file in order to avoid installing Explorer plugin

    Click on (menu) Settings -> Edit Popup Contextmenu and confirm the dialog box popping up. Right-click on the tab of the file being opened (should be contextMenu.xml) and click on Open Containing Folder in Explorer. From the Explorer window opened, drag the file shortcuts.xml to your Notepad++ window. Locate the XML node <UserDefinedCommands> and add the following line as a child entry to it:

    <Command name="Open HOSTS file" Ctrl="no" Alt="no" Shift="no" Key="0">$(NPP_DIRECTORY)\notepad++.exe -nosession "C:\Windows\System32\drivers\etc\hosts"</Command>

    The path also could be C:\Windows\SysNative\drivers\etc\hosts. Save the file and restart Notepad++. Now you should have an entry Open HOSTS file in the Run menu. The file will be loaded if you click on it.

  • @dinkumoil I am surprised at your energy)))

  • @andrecool-68

    It’s a question of honour… ;)

  • @dinkumoil Did someone summon you to a duel?

  • @andrecool-68

    No, duels are stupid. No need to be forced by someone. As I said, it’s a question of honour.

Log in to reply