Skip to content

Instantly share code, notes, and snippets.

@drHyperion451
Last active October 19, 2024 22:17
Show Gist options
  • Save drHyperion451/495efcaf234f113a1ef8e8fe233609c6 to your computer and use it in GitHub Desktop.
Save drHyperion451/495efcaf234f113a1ef8e8fe233609c6 to your computer and use it in GitHub Desktop.
One line batch windows script to know which process is refusing to eject your USB disk.
# USB_eject_ninja.bat
# One line batch windows script to know which process is refusing to eject your USB disk.
# For Windows 11, but it should work on any Windows version
# Stolen from this superuser.com post: https://superuser.com/questions/87364/can-windows-tell-me-what-is-using-my-usb-drive
# License? None lol I've grabbed this from a random user on the internet.
# Why this isn't a feature inside Windows GUI? No fucking clue.
# THIS WORKS IF YOU ALREADY TRIED TO EJECT THE DRIVE.
# Just copy and paste the line below inside any cmd in Windows. It should work without admin privileges.
wevtutil qe System /q:"*[System[(EventID=225)]]" /c:5 /f:text /rd:true;
# Ignore this line, it's just for not closing up the terminal if you download this file.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment