Skip to contentSkip to conversation

QEMU Menu for Windows

Qemu-devel Garth Dahlstrom 1 participant 1 message Aug 1, 2004

lore
Share & tools
lore
#0 lore raw

Attached is a batchfile that creates a simple numbered menu for running QEMU images under Windows:

Here is an example of the output:
=== QEMU Menu 1.0 ===
QEMU (C) 2004 Fabrice Bellard
QEMU Windows Port by kazu?
QEMU Menu (C) 2004 Garth Dahlstrom ([email protected])

Type the image number and hit enter to start QEMU:

[1] linux
[2] reactos-0.2.3
[3] freedos
[4] netbsd_1.6.2

[Q] to Quit

Enter your choice now

Signature · 3 lines
Northern.CA ===--
http://www.northern.ca/
Canada's Search Engine

@echo off
REM QEMU menu (C)2004 by Garth Dahlstrom ([email protected]) REM Licensed under GNU GPL (like it would work without the source anyway... :) )

cls
setlocal enabledelayedexpansion

:PrintMenu
set QEMU_IMG_Count=0

echo === QEMU Menu 1.0 ===

echo    QEMU (C) 2004 Fabrice Bellard
echo    QEMU Windows Port by kazu? 
echo    QEMU Menu (C) 2004 Garth Dahlstrom ([email protected]) 

echo.
echo Type the image number and hit enter to start QEMU:
echo.
for /R %%x in (*.img *.dsk) do set /A QEMU_IMG_Count+=1 && echo [!QEMU_IMG_Count!] %%~nx && set QEMU_IMG!QEMU_IMG_Count!=%%x echo.
echo [Q] to Quit
echo.
echo Enter your choice now

set /P QEMU_IMG_Choice=

SET QEMU_IMG_Choice=%QEMU_IMG_Choice:q=Q%
if "%QEMU_IMG_Choice%"=="Q" echo. && echo Quiting && GOTO CleanUP

echo.
echo.
echo Starting !QEMU_IMG%QEMU_IMG_Choice%! ...
echo.
echo.

if EXIST !QEMU_IMG%QEMU_IMG_Choice%! (
START qemu.exe -L . -m 128 -hda "!QEMU_IMG%QEMU_IMG_Choice%!" -enable-audio -localtime
) ELSE echo Invalid Choice... && echo. && goto PrintMenu

:CleanUp
REM Clean up environment
FOR /F "usebackq delims==" %%i IN (set QEMU_IMG) DO set %%i= set QEMU_IMG_Choice=
set QEMU_IMG_Count=

Pause