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
Storing user imput as a variable and then .....
Moderator: DosItHelp
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
You mean something like this?
[/code]
Code: Select all
:menu_1 Create a Ghost Image
set /p fname=Enter a filename or hit ENTER to quit: ||goto :eof
Start ghost32.exe -clone,mode=dump,src=f:\ghost\retail\%fname%.gho,dst=1 -sure -szel >null
GOTO:EOF
:menu_2 Restore a Ghost Image
set /p fname=Enter a filename or hit ENTER to quit: ||goto :eof
Start ghost32.exe -clone,mode=load,src=f:\ghost\retail\%fname%.gho,dst=1 -sure -szel >null
GOTO:EOF
[/code]
I will give this a try today and let you know.
Thank you for you quick reply. I just returned from out of town and I will give this a try sometime today and let you know.
Does WinPE have a command processor?
I can not get the menu to work under WinPE boot image.
I get a 'findstr' is not reconized as an internal or external command, operable program or batch file.
Any suggestions?
I get a 'findstr' is not reconized as an internal or external command, operable program or batch file.
Any suggestions?
This is my final batch layout
I had to simplify my batch file.
If anyone has any suggestions that would improve on this please let me know.
If anyone has any suggestions that would improve on this please let me know.
Code: Select all
@ECHO OFF
REM.-- Prepare the Command Processor
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
REM net use F: \\imageserver\images /user:user_name Password
set path=%path%;x:\ghost
:menuLOOP
echo.
rem echo.= Menu =================================================
echo.
REM for /f "tokens=1,2,* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo. %%B %%C
set choice=
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Main Menu º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º1. Create Ghost Imageº
echo º2. Load Ghost Image º
echo º º
echo º Enter = Exit º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
rem echo.&set /p choice=Make a choice or hit ENTER to quit: ||GOTO:EOF
echo.&set /p choice=Enter Selection= ||GOTO:EOF
echo.&call:menu_%choice%
GOTO:menuLOOP
::-----------------------------------------------------------
:: menu functions follow below here
::-----------------------------------------------------------
:menu_1 Create a Ghost Image
set /p fname=Enter a filename (Example: TERM0101) or hit ENTER to quit: ||goto :eof
x:
cd \ghost
rem --- This will create primary OS drive configuration ---
ghost32.exe /setosdrives /blind >> x:\ghost\startlog.txt
Start ghost32.exe -clone,mode=dump,src=1,dst=f:\ghost\retail\%fname%.gho -sure -szel >null
GOTO:EOF
:menu_2 Restore a Ghost Image
f:
cd\ghost\retail
dir
echo.
echo.================A List of Ghost Images to Choose From ========================
echo.
set /p fname=Enter a filename (Example: TERM0101) or hit ENTER to quit: ||goto :eof
x:
cd \ghost
rem --- This will create primary OS drive configuration ---
ghost32.exe /setosdrives /blind >> x:\ghost\startlog.txt
Start ghost32.exe -clone,mode=load,src=f:\ghost\retail\%fname%.gho,dst=1 -sure -szel >null
GOTO:EOF
:menu_
:menu_C Clear Screen
cls
GOTO:EOF