Windows root folder what is

How to Locate the Root Folder for Microsoft

Although each Microsoft operating system has a suggested default root folder, a user may choose to change this location at installation. Therefore, programmers who write software and scripts to run on a Microsoft operating system have no way of knowing the exact root folder for each computer. For the software or script to run successfully on the most computers possible, programmers use environment variables. The variable for the root folder is SYSTEMROOT. Using this variable in a command line tells you where a particular instance of the Microsoft operating system is installed.

Start your computer and log in to Windows. Click the Start button to bring up a search text box.

Type “cmd” into the text field and press “Enter.” A Windows command shell window opens.

Type “echo %SYSTEMROOT%» at the command prompt and press “Enter.” The result of this search is the root folder for Microsoft Windows.

Type “exit” at the command prompt to close the command shell.

  • By default, the system root folder for Microsoft Windows is C:/Windows. However, this can be changed for several reasons. The active partition on a hard drive could be designated by a letter other than C:, or the operating system might be Windows NT, in which case the system root folder is C:/WINNT by default.
  • Although you can change the system root variable at the command line, you should never do so. It will make your operating system inoperable.

Karren Doll Tolliver holds a Bachelor of English from Mississippi University for Women and a CELTA teaching certificate from Akcent Language School in Prague. Also a photographer, she records adventures by camera, combining photos with journals in her blogs. Her latest book, «A Travel for Taste: Germany,» was published in 2015.

Location of /root/ on Windows 10 Ubuntu

I installed the bash on Ubuntu on Windows 10 — the insider preview edition. Windows terminals are however are sort of cumbersome to use if one is used to Ubuntu’s terminal. I was wondering if there is a way to access the Ubuntu filesystem from Windows so that I can do the development in some other editor and run the code from Ubuntu-bash ?

3 Answers 3

Any terminal program that can open a Windows command prompt should be able to run bash (bash.exe launches the Windows Linux Subsytem), so you don’t have to be stuck with command.exe.

Conemu (mentioned by @anotherfred) or Cmder are some of the fan favorites. You can also use Powershell if you like that.

You can access your Windows files from WSL at /mnt/c (and /mnt/d if you have a d: drive, etc). That works relatively well if you want to do command line stuff and still access the files using your favorite Windows editor.

You can see your WSL file system from Windows at:

though I wouldn’t mess with it from within Windows.

/root would be under

/home would be under

These two are mounted separately so that they are not deleted when you remove WSL.

Windows 10 versions released since the end of 2017 (including the Fall Creators Update and Windows Insiders Builds 17063+) supports multiple linux distributions running on the same machine. In consequence, WSL must store the root filesystem for each distribution in a different location.

The root filesystem is not located anymore at

New location of the filesystem folders

Each linux distribution installed from the Windows Store stores the root filesystem in a different folder at

The vary from one distribution to the other. For instance, the following are the in my test computer:

  • Ubuntu 16.04 : CanonicalGroupLimited.Ubuntu16.04onWindows_79rhkp1fndgsc
  • Ubuntu 18.04 : CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc
  • Debian : TheDebianProject.DebianGNULinux_76v4gfsz19hv4
  • Kali linux: KaliLinux.54290C8133FEE_ey8k8hqnwqnmg
Читайте также:  Radius сервер установка windows

If you wanna access the root or the home filesystems, you must use the appropriated folders. For instance, to go to the folders for the KaliLinux, you must go to:

Obtaining the path using lxRunOffline

LxRunOffline is a tool to manage WSL linux distributions. It can be used to install or move a WSL distribution to any folder of your computer.

You can use lxRunOffline get-dir to obtain the path of the installation folder. The root is in the rootfs sub-folder.

Obtaining the path Programmatically

If you are interested, you can obtain the path using a program. The information about the installed distributions and their configuration is stored in the Windows Registry.

You can check the information using the regedit and the following path:

There is all the configuration of the diverse distributions you have installed. For instance, You can use Powershell to obtain the information of the base path for the default distribution.

To check the filesystems for all your installed distributions, you can use Powershell too.

What is the alternative for

I’m trying to use the command prompt to move some files, I am used to the linux terminal where I use

to specify the my home directory I’ve looked everywhere but I couldn’t seem to find it for windows command prompt ( Documents and Settings\[user] )

11 Answers 11

You’re going to be disappointed: %userprofile%

You can use other terminals, though. Powershell, which I believe you can get on XP and later (and comes preinstalled with Win7), allows you to use

for home directory.

You can %HOMEDRIVE%%HOMEPATH% for the drive + \docs settings\username or \users\username .

You can use %systemdrive%%homepath% environment variable to accomplish this.

The two command variables when concatenated gives you the desired user’s home directory path as below:

Running echo %systemdrive% on command prompt gives:

Running echo %homepath% on command prompt gives:

When used together it becomes:

Update — better version 18th July 2019.

Final summary, even though I’ve moved on to powershell for most windows console work anyway, but I decided to wrap this old cmd issue up, I had to get on a cmd console today, and the lack of this feature really struck me. This one finally works with spaces as well, where my previous answer would fail.

In addition, this one now is also able to use

as a prefix for other home sub-folders too, and it swaps forward-slashes to back-slashes as well. So here it is;

Step 1. Create these doskey macros, somewhere they get picked up every time cmd starts up.

Step 2. Create the cdtilde.bat file and put it somewhere in your PATH

Tested fine with;

Oh, also it allows lazy quoting, which I found useful, even when spaces are in the folder path names, since it wraps all of the arguments as if it was one long string. Which means just an initial quote also works, or completely without quotes also works.

All other stuff below may be ignored now, it is left for historical reasons — so I dont make the same mistakes again

old update 19th Oct 2018.
In case anyone else tried my approach, my original answer below didn’t handle spaces, eg, the following failed.

I think there must be a way to solve that. Will post again if I can improve my answer. (see above, I finally got it all working the way I wanted it to.)

My Original Answer, still needed work. 7th Oct 2018.
I was just trying to do it today, and I think I got it, this is what I think works well;

First, some doskey macros;

root folder equivalent in windows

Is C drive treated as the root folder in windows when one says \folder1\folder2\ in linux and windows C:\folder1\folder2.

10 Answers 10

In Windows it’s relative to what drive your current working directory is at the time. If your current directory is in the C drive then C:\ would be the root. If the current directory is the D drive then D:\ would be the root. There is no absolute root.

Читайте также:  Делаем загрузочную флешку windows 10 через rufus

At the filesystem level the Win32 API has no root folder, but as others have pointed out the Shell API does, ie. the Desktop. The Shell namespace is browsed with the (graphical) shell, which happens to be Explorer.exe.

At a much lower level, the Windows kernel also has a root folder, and the registry and filesystem are subfolders of it. This is relevant if you are writing a device driver. The Object Manager namespace can be browsed with a tool called WinObj.

If you’re running Windows CE then \ is the root directory. This resembles Unix’s / root directory. This is the only kind of Windows where you can get a simple answer to your question.

If you’re running Windows NT/2000/XP/2003 then the closest equivalent is the partition containing files NTLDR, NTDETECT.COM, BOOT.INI, and BOOTFONT.BIN. The BIOS and MBR find this partition by finding which drive to start booting, scanning the MBR, and looking for the active partition. Microsoft calls this the system partition. I’m not completely sure how a program can find which partition this was. Anyway, when you find which drive letter this is, say letter L, then you could say that L:\ is the root directory. 99% of the time this will be drive letter C:.

Also if you’re running Windows NT/2000/XP/2003 then you also have a partition which contains the Windows system files, such as directory \Windows or others. Microsoft calls this the boot partition. You can get the drive letter from the symbol %SystemDrive% as someone else said. If this is drive letter Q then you can say that Q:\ is the root of the system drive.

If you’re running Vista then things are more complicated. If you installed by booting the DVD, then the boot partition (containing the system files) is C: and your system partition (containing the boot files) is D:, unless they’re the same partition and then the partition is C:. But if you installed by having Windows running already, inserting the DVD and starting the installer under that Windows installation, then the drive letters could be almost anything.

In Windows 95/98/ME the BIOS and MBR would look for files IO.SYS, COMMAND.COM, and some others, in the active partition. This would usually get drive letter C: so the root partition would be C:. As always, the Windows system files could be installed in directory \Windows or others on any partition.

Some people talk about a desktop. Well sure, each logged in user has a desktop. This is somewhat like each Unix user’s home directory. It sure isn’t a root directory.

Addendum: In the second-to-last paragraph, about Windows 95/98/ME, I typed «so the root partition would be C:.» That is, letter C, a colon, a backslash, and then a period for the end of the sentence (not part of the directory name). When viewing the page, the backslash isn’t showing. But when editing this answer to add this addendum, the backslash is there exactly as it should be, exactly as I typed it.

What is the home directory on Windows Subsystem for Linux?

When I start bash on Windows Subsystem for Linux, it drops me in the directory

When I ls this directory, I see the directories Desktop , Documents , etc. that I can see are in C:\Users\ using the Windows File Explorer. Since this is where the bash program started, I expected this is my home directory, but when I type either cd or cd

I am brought to

which contains my .bashrc , .profile etc. file which I would expect to find in my home directory in a Linux box. Moreover, entering cd ../.. from here I can see the directories bin , etc and so on, again as expected on a Linux box.

Читайте также:  Com objects in windows

I have two questions regarding all this:

  1. What exactly is /mnt/c/Users/ compared with C:\Users\ ? It seems they are one in the same—so what is /mnt/c/ ?
  2. How can I view the files in /home/ using the Windows File Explorer? Not that I’d really ever want to—I’m just trying to get a feel for how Windows is organizing this Subsystem for Linux thing.

11 Answers 11

In the latest versions [2020], the file system is accessed from:

Previously, as of 2018, The current path is related to which distribution you have installed from the Microsoft Store rather than one global path; for Ubuntu, it was located at:

Other distributions should be (to be confirmed) in a similar location under their respective folders within:

In Bash, to view the current directory in Windows File Explorer just enter:

Don’t leave out the «.».

This will open windows explorer at the current folder and you can see where everything is in relation to the rest of your Windows system.

  1. /mnt/c is the exact same as C:\ . It’s just the syntax for getting to it from WSL.
  2. Look in C:\Users\ \AppData\Local\Lxss\rootfs .

About the filesystem mounted on /mnt/c

  1. What exactly is /mnt/c/Users/ compared with C:\Users ? It seems they are one in the same—so what is /mnt/c/?

In contrast to Windows, Linux (and the other systems based on Unix) use a single folder structure independent of the number of disks you have. If you have multiple disks, all these disks must me mounted into the folder structure at some point.

  • Typically, all the disks (different than the used to boot the system) are mounted in a folder named /mnt or /media

WSL has an special type of filesystem named DrvFS that gives you access to the disks used in windows. You can use DrvFS to mount, not only your windows filesystem, but also network disks and other media types.

  • In WSL, by default, the C: disk in windows is mounted under /mnt/c
  • If you have another disk, for instance a D: disk in windows, it will be mounted under /mnt/d

The files you can see in /mnt/c are the same you have in C: . If you modify some file, you will get the changes in the windows too.

About the location of /home/

  1. How can I view the files in /home/ using the Windows File Explorer? Not that I’d really ever want to—I’m just trying to get a feel for how Windows is organizing this Subsystem for Linux thing.

In WSL, all the linux filesystem is located under a Windows folder. The location of the folder depends on the version of Windows and of the WSL distribution you are using.

  • Initial versions of WSL store the linux filesystem in %LOCALAPPDATA%\Lxss\rootfs
  • WSL distributions installed from the Windows Store, starting in Windows Build 16215 (mid of 2017), use a folder like %LOCALAPPDATA%\Packages\\LocalState\rootfs . The name of the package varies depending on the distribution (e.g. it is different for Ubuntu than for Debian). For Ubuntu on Windows it is CanonicalGroupLimited.UbuntuonWindows_ , for example.
  • Linux distributions installed using other tools, such as lxRunOffline or WSL-DistroLauncher may store the linux filesystem into any location.

You may check many options to know the location of the WSL folder. For instance, I think the easiest option is to use lxRunOffline to know the installation folder.

Once you know the location of the installation folder, the /home/ is under \rootfs\home\username .

  • For instance, if your installation folder is c:\wsl\ubuntu
  • the /home/ is in c:\wsl\ubuntu\rootfs\home\username

NOTE: Both Linux and Windows stores file permissions in different ways. Nowadays, the WSL DrvFS stores the Linux permissions as Streams (metadata) attached to the files you can see in Windows. Microsoft does not recommend to modify linux files using Windows programs. It is possible that some Windows applcations damage the linux permissions without notice it.

Оцените статью