@echo off
call :filedialog file
echo selected file is : "%file%
pause
exit /b
:filedialog :: &file
setlocal
set dialog="about:<input type=file id=FILE><script>FILE.click();new ActiveXObject
set dialog=%dialog%('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);
set dialog=%dialog%close();resizeTo(0,0);</script>"
for /f "tokens=* delims=" %%p in ('mshta.exe %dialog%') do set "file=%%p"
endlocal & set %1=%file%
Diff to Previous Revision
--- revision 1 2016-05-25 12:58:06
+++ revision 2 2017-03-27 13:20:41
@@ -1,6 +1,14 @@
+@echo off
+call :filedialog file
+echo selected file is : "%file%
+pause
+exit /b
+
+
+:filedialog :: &file
+setlocal
set dialog="about:<input type=file id=FILE><script>FILE.click();new ActiveXObject
set dialog=%dialog%('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);
set dialog=%dialog%close();resizeTo(0,0);</script>"
-
for /f "tokens=* delims=" %%p in ('mshta.exe %dialog%') do set "file=%%p"
-echo selected file is : "%file%"
+endlocal & set %1=%file%