How to delete GRUB files from a Boot EFI partition in Windows 10


After several failed attempts to dual-boot Ubuntu 15.04 and Windows 10 on a single hard drive and on a computer with UEFI firmware, and not knowing what caused the first failed attempt, I figured that subsequent failed attempts must have been due to an existing Ubuntu GRUB folder in the Boot EFI folder.

Especially since the machine always froze when the installer is attempting to install GRUB

So I thought that If I could just delete the ubuntu folder from the Boot EFI folder, that the installation would complete – successfully. Ultimately, it didn’t, but I figured out how to delete GRUB files from inside Windows 10, from the command line.

This post documents how it was done. It involved, from the command line, listing and selecting the detected hard drives, listing the partitions on the hard drive, then, finally, listing and deleting the target folder. Another reason you might want to do this, is if you deleted the Linux partitions, which would not automatically delete the GRUB files from the Boot EFI folder.

To start, log into Windows 10, click on the menu and type cmd. Then right-click on the terminal application’s icon and select run as administrator. Figure 1 show the commands (underlined) used to accomplish the first step – listing and selecting the hard drive. To make it possible to copy-and-paste, for those who might need to, I’ve provided the commands in the code block after the last image.

Related Post:  3 affordable laptops for your spring computing

In this figure, the target disk is shown as a 465 GB hard drive, with GPT partition.

Windows 10 diskpart
Figure 1: Using diskpart to list hard drives detected on Windows 10

After the target disk has been selected, its partitions are listed, so that the partition (volume) that corresponds to the Boot EFI folder can be identified. In Figure 2, that partition is Volume 2. It’s usually the only volume with FAT32 in the Fs (file system) column, and System in the Info column. After it has been identified and selected, you assign it a drive letter to make it easier to work with. In this example, I assigned it a drive letter D. After that, exit diskpart.

Listing Windows 10 partitions
Figure 2: Listing disk partitions on Windows 10

The final task involves changing into the Boot EFI folder, listing its contents to identify what subfolder the GRUB files would be. It will be in the EFI folder. The GRUB files for the distribution that was installed will be under a folder of the same name as the distribution. For example, if Ubuntu was installed, as in this example, the name of the folder will be ubuntu. Delete the folder using the rmdir /s command. That’s the Windows 10 equivalent of the Unix/Linux rm -r command.

Delete Ubuntu Boot EFI GRUB files
Figure 3: Deleting non-empty Ubuntu GRUB directory in Windows 10

All the commands used are given in this code block. Note that this procedure is not necessarily the best or only way to go about do this, so if you know of a better method, post a comment.

## These commands are used to identify and select the hard drive


list disk

sel disk 0

## These commands are used to list the partitions, select the Boot EFI partition, 
## then assign it a drive letter

list vol

sel vol 2

assign letter=D:


## These commands are used to change into the Boot EFI folder and delete the GRUB folder

cd /d D:


ls EFI

cd EFI


rmdir /s ubuntu


Share on facebook
Share on twitter
Share on pinterest
Share on linkedin

Hola! Did you notice that no longer run network ads?  Yep, no more ads from the usual suspects that track and annoy you across the Internet. But since I still need to pay to keep the site running, feel free to make a small donation by PayPal or your favorite cryptocurrency.

  • Bitcoin
  • Ethereum
  • Xrp
  • Bitcoin cash
  • Bitcoin sv
  • Litecoin
  • Binance coin
  • Cardano
  • Ethereum classic
Scan to Donate Bitcoin to bc1qzvlte2m224zkayhdc7fdfjkp2rsgt0l5a496ua

Donate Bitcoin to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin

Scan to Donate Ethereum to 0x0F4362DFF77F3Ba0Dc637F5f3Eba35D09a2fA60C

Donate Ethereum to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum

Scan to Donate Xrp to r4ggjvL36njsMCYTkJ3S7cTHscPsMsSGQv

Donate Xrp to this address

Scan the QR code or copy the address below into your wallet to send some Xrp

Scan to Donate Bitcoin cash to qrs0dedzp9t55af3nfwypydghp29r0xguy9s20fz2k

Donate Bitcoin cash to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin cash

Scan to Donate Bitcoin sv to 15K9TLyVDBtLuG9cYvXCX9SSkq9C9oUKHK

Donate Bitcoin sv to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin sv

Scan to Donate Litecoin to LetJ9QQMb7u2LMZ9Tu6rtHwcBcQFW98fbG

Donate Litecoin to this address

Scan the QR code or copy the address below into your wallet to send some Litecoin

Scan to Donate Binance coin to bnb1ga8trq08ssqepd90v6225nzfgy448pu5pw8gxp

Donate Binance coin to this address

Scan the QR code or copy the address below into your wallet to send some Binance coin

Scan to Donate Cardano to addr1qx2354yw49etstfljpdhwja3ajjlt487lg95vu9ngy2q6vu4rf2ga2tjhqknlyzmwa9mrm997h20a7stgectxsg5p5esq5l7d9

Donate Cardano to this address

Scan the QR code or copy the address below into your wallet to send some Cardano

Scan to Donate Ethereum classic to 0xcD6CC972a2297FcafACDcfE042C55C69516a9264

Donate Ethereum classic to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum classic

Subscribe for updates. Trust me, no spam!

Sponsored links

1. Attend Algorithm Conference, a top AI and ML event.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.

Upcoming events

186 Responses

  1. I completed the steps, rebooted and received `Reboot and Select proper boot device`. My setup was almost identical to the steps involved, and Microsoft was left in the EFI. I think this was grub 2 so I’m thinking I might need to boot to USB and update it.

    1. I figured out there was a submenu under the bios `Boot` menu that was still referencing the now deleted `ubuntu`. I switched it to `Windows` and it worked.

  2. Hi buddy, my friend and I installed Android 6.0 using Gpart tool and Flash Drive on a dummy Windows 10 test PC. Later we deleted the HDD volume where the GRUB files were from Windows Disk Management Tool,and upon boot up of course, we have the GRUB Loading…Error 22.

    Since this is just a test PC to experiment on, any method on how to fix this error 22 without using Windows Boot Disc or USB,assuming we don’t have other means to boot into Windows.

    1. On a UEFI system, GRUB files are installed in the UEFI System Partition, which was created when you installed Windows 10. If you deleted that partition, I don’t see how you can boot that system again. But you can always try booting into Windows by selecting Windows Boot Manager from the computer’s boot menu. I don’t think that would make any difference, but at least you can verify what I just wrote.

  3. I tried searching for the solution in internet from 2 days. I tried so many other methods, which did not work. But now I came across your site and tried your solution. Well it worked! Thank you. Its such a compact solution for the problem. I should have come across your site at the beginning.
    Thankss a lotttttt!!!!!!!!!!!!!

  4. I have a problem with line no. 24 (ls) my pc says- ‘ls’ is not recognized as an in
    operable program or batch file. What should i do?

    1. Well, it works totally fine. You might have done a mistake. Because of that don’t tell others not to try! I tried it just now and it works like a charm.

      1. By mistake I replied to your comment. I wanted to reply for the person who told that this is not working! Sorry..

  5. Well, this script generally does:
    mountvol Z: /s
    rmdir /s Z:\ubuntu
    mountvol Z: /d

    now your procedure actually took me one step farther away from solution. Earlier i could use grub to chainload microsoft efi, now i don’t even have this, and my disk is totally unbootable. This deserves a huge ‘do not try this any more’ warning sign.

      1. I have the same problem.
        After executed your given commands, I couldn’t reach grub> which I can rely on “chainholder” help to enter into Windows10; The laptop automatically entered into “Setup” after reboot in every time.
        It looks I have to reset the whole system now.

  6. Hi just wanted to let you know:
    Your process of listing disks before volumes in diskpart is meaningless; the “list” command takes ‘disk’ or ‘vol’ as an argument to decide which to show you… entire drives or individual volumes. Same for “select”; it takes ‘disk’ or ‘vol’ then an integer to signify which disk or volume to select. Selecting an entire disk first has literally no bearing on selecting an individual volume afterwards; all volumes are accessible regardless. If you wanted to perform the operation on an entire disk, you would use “sel disk x” and perform the operation. Obviously here we only want a single partition, so you can just skip straight over selecting a disk.

  7. hey man i did every thing as instructed but when i try the ls function it says ls is not recognised as an internal or external command. please help me what can i do

  8. Hey, I gave new drive letter J and yeah it worked well but now it also got displayed on My Computer with memory of 256MB, so now how do I Unassign the letter?

  9. Dude you’re awesome! You just saved me hours worth of work! It definitely works with windows 10,the only catch is instead ‘ls’ use ‘dir’. Thanks again!

  10. This does not work for me. I am able to assign a letter (Z) to the system drive that contains the EFI folder, but then when I try doing “cd /d Z:” the response I get is “Access is denied”. Any ideas?

  11. hmm,i do have aquestion,what is that ls command,is not a batch or command in windows 10 : ‘ls’ is not recognized as an internal or external command,operable program or batch file.
    maybe u should try that again and find another thing than ls,maybe dir ?
    i do wander why ppl stop actually doing that or why they use something like this from maybe an older windows version ?
    anyway,i managed to fix the thing,i hope without the ls but with dir,even tho i am not like this cases in here with just a dual boot,i am a multiboot guy,i have like 5 linux distros besides windows,why ? i love more distros and i keep them and use them all,the wose that i had to do is find and still not sure if i did right,is the slackware bootloader,as it is lilo and not grub,i hope that the folders were goofiboot and slackware,as i intend to delete it and get on fedora,it is hard to keep lilo and grub,it gives many errors

    Spot on, it worked like a charm! The forums are full of people trying to fix this problem and I will spread the word of your cure! I was sweating bullets and now I dance the dance of relief! Thank you…

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest

On social media
Via my newsletter

Partner links

1. Attend Algorithm Conference, a top AI and ML event for 2021.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.
Hacking, pentesting distributions

Linux Distributions for Hacking

Experts use these Linux distributions for hacking, digital forensics, and pentesting.


The authors of these books are confirmed to speak during

Algorithm Conference

T-minus AI

Author was the first chairperson of AI for the U.S. Air Force.

The case for killer robots

Author is the Director of the Center for Natural and Artificial Intelligence.

Why greatness cannot be planned

Author works on AI safety as a Senior Research Scientist at Uber AI Labs.