Created
August 10, 2014 19:15
-
-
Save DiegoQueiroz/1a645df98e2b7004b09c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
@cls | |
set tempfile="%TEMP%\diskscrp.dsk" | |
echo. | |
echo === Disk removal tool === | |
echo. | |
echo Select the disk volume number | |
echo (if the disk has multiple volumes, select any of them) | |
echo. | |
echo list volume | diskpart | findstr /C:Volume /C:--- | |
echo. | |
set /p volume=" Selected volume: " | |
echo. | |
echo select volume %volume% >>%tempfile% | |
echo offline disk >>%tempfile% | |
echo online disk >>%tempfile% | |
diskpart /s %tempfile% | findstr /C:"not valid" | |
if "%ERRORLEVEL%"=="1" ( | |
echo Disk has been unlocked successfully. Try to safely remove it now. | |
) | |
del /F %tempfile% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment