@echo off call :filedialog file echo selected file is : "%file% pause exit /b :filedialog :: &file setlocal set dialog="about:" for /f "tokens=* delims=" %%p in ('mshta.exe %dialog%') do set "file=%%p" endlocal & set %1=%file%