Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Menu in Start.bat

Created: 25 Jul 2012 • Updated: 27 Jul 2012 | 15 comments
This issue has been solved. See solution.

Hi All,

I've used Ghost in the past, but have run across an interesting project.  Is there a way to create a menu system within Start.bat

where the users can choose say 1. Restore and Image, 2. Create and image or 3. Run Ghost walk?

I have the menu and everything built and have attempted to work it into Start.bat.

The problem I am running into is that I need to use the Choice.exe out of the system32 folder.

When I add that command into the "Additional Files" screen and set the destination folder to "X:\Ghost"

Ghost Boot Wizard will work, right up to the point where it needs to copy Choice.exe.

I recieve a "You do not have sufficient access rights to perform this operation....etc, etc"

Here is what I have as far settings:

Version 11.5.1.2266

OS: Windows 7, 64-Bit 

Local admin is the owner to the C: drive

local admin has full rights to Choice.exe

Run ghost boot wizard as administrator

Any insight would be greatly appreciated.  thanks in advance,

-Jeff

Comments 15 CommentsJump to latest comment

Terry BU's picture

are you using the WinPE boot disk, or PCDOS?  if you are using WinPE, you can add an extra file that you call out of STARTNET.CMD.

Jeff42's picture

Hi Terry,

Sorry, forgot to add that.  Yes.  Win PE is being used.

-J

EdT's picture

WinPE can also support a GUI if it is built as an HTA file. This is much more attractive than a command line based solution and basically you can code your solution in vbscript.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

Jeff42's picture

Thanks for all the info.  Very helpful!

Ok, I have Startnet modified, saved and back in the .wim file.

Unfortunately nothing from my menu shows up, it looks like the default information

Is there a tutorial somewhere that can walk me through how to do this?

I'm very interested in he HTA but I would like to get a simple menu working first

(I just re-read the posts.  I was creating the menu IN startnet, not calling out to it)

-J

Terry BU's picture

have you tried running it as a command to span a new window?

my startnet.cmd looks like this

wpeinit
wpeutil disablefirewall
start /min cmd.exe
cmd /c x:\scripts\vnc.cmd
x:\scripts\setpath.cmd
 
also, does your startnet window "echo" anything to give you info on what it is doing?  mine above is spawning things, so i can watch it go
Jeff42's picture
Terry,
 
Listed below is what I had in a Menu.bat file.  I then coppied that into startnet.
I have tried REM'ing out the wpeinit line and just running the code below.  Some of the code is
repetitive until I get things ironed out.
 
Am I using the wrong syntax?
 
@echo off
:start
cls
echo --------------------- MAIN MENU ---------------------
echo 1 - Create an image
echo 2 - Restore an image
echo 3 - Run Ghostwalk
echo X - Exit
echo -----------------------------------------------------
 
choice /c 123x /m "Enter Command: "
rem if errorlevel x goto exit
if errorlevel 3 goto ghostwalk
if errorlevel 2 goto restoremenu
if errorlevel 1 goto createmenu
 
:createmenu
cls
echo ---------------- CREATE AN IMAGE --------------------
echo 1 - Join to Lab1
echo 2 - Join to Lab2
echo 3 - Join to Lab3
echo 4 - Join to Lab4
echo 5 - Join to Lab5
echo 6 - Join to Lab6
echo 7 - Join to Lab7
echo 8 - Join to Lab8
echo X - Exit
echo -----------------------------------------------------
choice /c:12345678x /m "Enter Command: "
if errorlevel x goto exit
if errorlevel 8 goto lab8
if errorlevel 7 goto lab7
if errorlevel 6 goto lab6
if errorlevel 5 goto lab5
if errorlevel 4 goto lab4
if errorlevel 3 goto lab3
if errorlevel 2 goto lab2
if errorlevel 1 goto lab1
 
:lab8
echo Joining GhostCast session EIGHT
x:
x:\ghost\ghost32.exe -ja=lab8 -sure -rb
goto exit
 
:lab7
echo Joining GhostCast session SEVEN
x:
x:\ghost\ghost32.exe -ja=lab7 -sure -rb
goto exit
 
:lab6
echo Joining GhostCast session SIX
x:
x:\ghost\ghost32.exe -ja=lab6 -sure -rb
goto exit
 
:lab5
echo Joining GhostCast session FIVE
x:
x:\ghost\ghost32.exe -ja=lab5 -sure -rb
goto exit
 
:lab4
echo Joining GhostCast session FOUR
x:
x:\ghost\ghost32.exe -ja=lab4 -sure -rb
goto exit
 
:lab3
echo Joining GhostCast session THREE
x:\ghost\ghost32.exe -ja=lab3 -sure -rb
goto exit
 
:lab2
echo Joining GhostCast session TWO
x:
x:\ghost\ghost32.exe -ja=lab2 -sure -rb
goto exit
 
:lab1
echo Joining GhostCast session ONE
x:
x:\ghost\ghost32.exe -ja=lab1 -sure -rb
goto exit
 
:restoremenu
echo ---------------- RESTORE AN IMAGE -------------------
echo 1 - Join to Lab1
echo 2 - Join to Lab2
echo 3 - Join to Lab3
echo 4 - Join to Lab4
echo 5 - Join to Lab5
echo 6 - Join to Lab6
echo 7 - Join to Lab7
echo 8 - Join to Lab8
echo X - Exit
echo -----------------------------------------------------
choice /c:12345678x /m "Enter Command: "
if errorlevel x goto exit
if errorlevel 8 goto lab8
if errorlevel 7 goto lab7
if errorlevel 6 goto lab6
if errorlevel 5 goto lab5
if errorlevel 4 goto lab4
if errorlevel 3 goto lab3
if errorlevel 2 goto lab2
if errorlevel 1 goto lab1
 
:lab8
echo Joining GhostCast session EIGHT
x:
x:\ghost\ghost32.exe -ja=lab8 -sure -rb
goto exit
 
:lab7
echo Joining GhostCast session SEVEN
x:
x:\ghost\ghost32.exe -ja=lab7 -sure -rb
goto exit
 
:lab6
echo Joining GhostCast session SIX
x:
x:\ghost\ghost32.exe -ja=lab6 -sure -rb
goto exit
 
:lab5
echo Joining GhostCast session FIVE
x:
x:\ghost\ghost32.exe -ja=lab5 -sure -rb
goto exit
 
:lab4
echo Joining GhostCast session FOUR
x:
x:\ghost\ghost32.exe -ja=lab4 -sure -rb
goto exit
 
:lab3
echo Joining GhostCast session THREE
x:\ghost\ghost32.exe -ja=lab3 -sure -rb
goto exit
 
:lab2
echo Joining GhostCast session TWO
x:
x:\ghost\ghost32.exe -ja=lab2 -sure -rb
goto exit
 
:lab1
echo Joining GhostCast session ONE
x:
x:\ghost\ghost32.exe -ja=lab1 -sure -rb
goto exit
 
:ghostwalk
echo Welcome to Ghostwalk
x:
x:\ghost\ghwalk32.exe /REBOOT /SURE
goto exit
 
:exit
echo Press enter to exit
pause
exit
Terry BU's picture

you are saying that that script never runs?  if not, when you go find the startnet.cmd file if you open it for editing inside the PE session, is all of that stuff in there?

I have had a number of situations were it seems the PE file doesnt actually get replaced, it just puts another one in there

Jeff42's picture

Correct.

I just ran the ghost usb, and in the command prompt I did a TYPE STARTNET.CMD and received

the information below:

echo off

if exist c:\ghost\unattend.xml (wpeinit /unattend=c:\ghost\unattend.xml)

else if exist x:\ghost\unattend.xml (wpeinit /unattend=x:\ghost\unattend.xml)

else (wpeinit

set path = %path%;x:/ghost

x:

cd \ghost

ghost32.exe /setosdrives /blind >> x:\ghost\startlog.txt

start ghost32.exe

)

The startnet that I had modified has only 2 lines wpeinit and call menu.bat.

Jeff42's picture

The startnet.cmd file that I have been editing in the boot.wim file

has a modified date of 7/26/2012...which makes sense.

The startnet.cmd file that is being run after I unmount the drive shows a modified date of

06/19/2012...which does not make sense

Jeff42's picture

I found out whats been happening.

It would appear that I owe those who have helped an apology, as my instructions that were left behind

from my predecessor did not include the COPYPE portion.  

My apologies.

Onward.  The menu now appears (as you may have guessed) and I can step through to the sub-menus.

However, when I want to run the command, for instance the ghost command and try to connect to "LAB1"

I receive the following message:

Joining GhostCast Session ONE

The system cannot find the path specified.

Press enter to exit

Press any key to continue...

A couple of questions,  Does Wpeinit have to be in STARTNET?  Would it be better to put the menu

in a separate batfch file and make a call to it? Why does it not run the commands out of STARTNET?

-J

EdT's picture

When writing batch scripts to run in WinPE, I find that it helps to always include the full path to everything you need to use, and assume that no PATH environment variable exists.

Additionally, instead of:

:lab1
echo Joining GhostCast session ONE
x:
x:\ghost\ghost32.exe -ja=lab1 -sure -rb
goto exit
 
TRY:
 
:lab1
echo Joining GhostCast session ONE
x:
CD \ghost
ghost32.exe -ja=lab1 -sure -rb
goto exit
 

By making sure you change directory to the target folder first, you ensure that any other dependent files that your executable needs can be found in the current working directory.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

Jeff42's picture

I had thought that might have been the case.

At the beginning of my batch file I have the following:

wpeinit
wpeutil disablefirewall
start /min cmd.exe
 
cd\
x:
cd ghost
 
I still receive the same path error
 
-J
EdT's picture

Try it this way around:

x:

cd\

cd Ghost

The way you have it 

cd\  -sets the current drive to the root folder

x:  -this selects the X: drive but the default folder could be anything, such as x:\windows\system32

cd ghost - this tries to set the folder to x:\windows\system32\ghost if the default folder was x:\windows\system32.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

Jeff42's picture

EdT,

Ok, I will place that in the next editing.

New findings:  When I have the command prompt open and look at the directory the only things

I have listed are:

<DIR> Prpogram Files

<DIR> Users

<DIR> Windows

No Ghost directory... ?

Jeff42's picture

created the Ghost directory in the batch file,

copied everything over from the USB

Works great!

Thank you all for your help and for putting up with my ineptitude

-Jeff

SOLUTION