@echo off
title Backup Driver Windows

:: Scelta cartella tramite finestra grafica
for /f "delims=" %%i in ('powershell -STA -Command ^
"Add-Type -AssemblyName System.Windows.Forms; ^
$f=New-Object System.Windows.Forms.FolderBrowserDialog; ^
if($f.ShowDialog() -eq 'OK'){ $f.SelectedPath }"') do set DEST=%%i

if "%DEST%"=="" (
    echo Operazione annullata.
    pause
    exit /b
)

echo.
echo Verrà richiesto di inserire:
echo - Altro utente
echo - Password
echo.

:: Avvia PowerShell chiedendo credenziali
powershell -NoProfile -Command ^
"$cred = Get-Credential; ^
Start-Process powershell -Credential $cred -ArgumentList '-NoExit -Command Export-WindowsDriver -Online -Destination ""%DEST%""'"

pause