@echo off

net session >nul 2>&1
if %errorlevel% neq 0 (
    echo Requesting administrative privileges...
    if "%*"=="" (powershell -Command "Start-Process '%~f0' -Verb RunAs") else (powershell -Command "Start-Process '%~f0' -ArgumentList '%*' -Verb RunAs")
    exit /b
)

if [%1]==[] (
echo ========= Instructions =========
echo Please drag and drop files onto this batch.
pause
exit /B 1
) else (
(
    echo select vdisk file="%1"
    echo detach vdisk
    echo attach vdisk readonly
    echo compact vdisk
    echo detach vdisk
) | diskpart
echo Finished.
pause
)