Storing user imput as a variable and then .....
Posted: 05 May 2009 22:28
I have created a Ghost WinPE boot disk that starts up and automaticly restores a ghost image. I want to expand this so the user is prompted with two choices.
So far I have a very basic batch menu that gives the user two choices. To load or dump a gost images. The problem I have is the menu is very limited. I am forced with a set file name (4840-E44.GHO) and I would have to manually edit the file name to meet my needs.
I want the user to select if they want to load or dump an image. Once they select one of these two options, I want to prompt them with the file name they want to use. Once they provide a name, I want to insert this name into the command line when I startup ghost to dump or restore an image file based on the name the user provides.
I have include the code I have so far that does not include any variables for aghost file name.
I would appreciate any help anyone is willing to provide.
@ECHO OFF
REM.-- Prepare the Command Processor
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
:menuLOOP
echo.
echo.= Menu =================================================
echo.
for /f "tokens=1,2,* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo. %%B %%C
set choice=
echo.&set /p choice=Make a choice or hit ENTER to quit: ||GOTO:EOF
echo.&call:menu_%choice%
GOTO:menuLOOP
::-----------------------------------------------------------
:: menu functions follow below here
::-----------------------------------------------------------
:menu_1 Create a Ghost Image
Start ghost32.exe -clone,mode=dump,src=f:\ghost\retail\4840.E44.gho,dst=1 -sure -szel >null
GOTO:EOF
:menu_2 Restore a Ghost Image
Start ghost32.exe -clone,mode=load,src=f:\ghost\retail\4840.E44.gho,dst=1 -sure -szel >null
GOTO:EOF
:menu_
:menu_C Clear Screen
cls
GOTO:EOF
So far I have a very basic batch menu that gives the user two choices. To load or dump a gost images. The problem I have is the menu is very limited. I am forced with a set file name (4840-E44.GHO) and I would have to manually edit the file name to meet my needs.
I want the user to select if they want to load or dump an image. Once they select one of these two options, I want to prompt them with the file name they want to use. Once they provide a name, I want to insert this name into the command line when I startup ghost to dump or restore an image file based on the name the user provides.
I have include the code I have so far that does not include any variables for aghost file name.
I would appreciate any help anyone is willing to provide.
@ECHO OFF
REM.-- Prepare the Command Processor
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
:menuLOOP
echo.
echo.= Menu =================================================
echo.
for /f "tokens=1,2,* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo. %%B %%C
set choice=
echo.&set /p choice=Make a choice or hit ENTER to quit: ||GOTO:EOF
echo.&call:menu_%choice%
GOTO:menuLOOP
::-----------------------------------------------------------
:: menu functions follow below here
::-----------------------------------------------------------
:menu_1 Create a Ghost Image
Start ghost32.exe -clone,mode=dump,src=f:\ghost\retail\4840.E44.gho,dst=1 -sure -szel >null
GOTO:EOF
:menu_2 Restore a Ghost Image
Start ghost32.exe -clone,mode=load,src=f:\ghost\retail\4840.E44.gho,dst=1 -sure -szel >null
GOTO:EOF
:menu_
:menu_C Clear Screen
cls
GOTO:EOF