FILE SELECTOR DIALOG IN BATCH + CANCEL Button

FILE SELECTOR DIALOG IN BATCH + CANCEL Button

 

 

 

@echo OFF
::dimm edit = cancel action is added
:start
:: DDX set file at zero value
set “file=”
call :filedialog file
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%
:: dimm if value of file is “nothing”, so goto…
if “%file%” equ “” (GOTO fail) else (goto :pass)
::echo echo of file : %file%
timeout /T 4

:pass
COLOR A
cls
COLOR A
echo ::Passed
echo File is : “%file%”
echo.
goto start

:fail
CLS
COLOR C
Echo ::Canceled
echo.&echo.
echo XXXX
echo :Fail here
echo XXXX
timeout /T 4
goto start

Leave a comment

Your email address will not be published. Required fields are marked *