Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
OM3
- Posts: 32
- Joined: 17 Mar 2014 08:43
#1
Post
by OM3 » 17 Mar 2014 08:48
I want to execute this in a bat file:
There will only be one iso file in the directory
I want the above command to be processed
I'm not sure where best to start
What would be amazing is: if there where more than one iso file, then I would get a window popup asking me to choose which one
But... that would be asking for too much?

Any help would be great
Thanks
OM
-
aGerman
- Expert
- Posts: 4743
- Joined: 22 Jan 2010 18:01
- Location: Germany
#2
Post
by aGerman » 17 Mar 2014 11:57
Try something like that:
Code: Select all
@echo off &setlocal
set "n=0"
for %%i in (*.iso) do (
set /a "n+=1"
setlocal EnableDelayedExpansion
for /f "delims=" %%j in ("!n!") do (endlocal &set "file_%%j=%%i")
)
if %n%==0 goto :eof
:loop
set "inp="
set "file="
if %n% gtr 1 (
for /l %%i in (1 1 %n%) do (
call echo %%i -- %%file_%%i%%
)
echo(
set /p "inp=Choose a number: "
echo(
) else set "inp=1"
setlocal EnableDelayedExpansion
for /f "delims=" %%i in ("!file_%inp%!") do (endlocal &set "file=%%i")
if not exist "%file%" goto :loop
isoburn /q "%file%"
Regards
aGerman