Link to home
Start Free TrialLog in
Avatar of aravind anche
aravind ancheFlag for United States of America

asked on

command prompt wont close after executing batch file

I have a batch file to install MSoffice in MDT. After installing MSOffice command prompt screen wont go away. So the Lite touch installation wont go away and deployment stuck there.
Here is the batch file:

@echo off

ECHO "Please wait, Installing Microsoft Office Applications 2010"
ECHO .
ECHO .

@echo off

Echo "Copying Desktop MSP to Updates"
md "C:\MSOCache\All Users"
copy "K:\APPS\MSOffice2010ENT\MST\2010-laptop.msp" "C:\MSOCache\All Users\2010-laptop.msp"


cls
echo "Installing Office 2010 Enterprise"
"K:\APPS\MSOffice2010ENT\setup.exe" /adminfile "C:\MSOCache\All Users\2010-laptop.msp" /Config "K:\APPS\MSOffice2010ENT\MST\config-install.xml"


I tried keeping end and exit at the end but then batch file wont run. also i tried timeout out too

Thanks
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

your command prompt is waiting for the program(s) to finish.

add a start before the executing call.

EG:
"K:\APPS\MSOffice2010ENT\setup.exe" /adminfile "C:\MSOCache\All Users\2010-laptop.msp" /Config "K:\APPS\MSOffice2010ENT\MST\config-install.xml"

becomes

start "K:\APPS\MSOffice2010ENT\setup.exe" /adminfile "C:\MSOCache\All Users\2010-laptop.msp" /Config "K:\APPS\MSOffice2010ENT\MST\config-install.xml"

Open in new window


to make the process kick off and not have the bat file wait for completion.
Avatar of aravind anche

ASKER

Thanks,

I tried that too
I added start and also start "" at the start. When I do that the batch file wont run.

start "setup.exe" /adminfile "C:\MSOCache\All Users\2010-laptop.msp" /Config "config-install.xml"

i changed the command as I imported the application to MDT and they are in same folder now. Sorry i would have mentioned that in the question.
try the following:
start "Install MS OFFICE 2010" /D "K:\APPS\MSOffice2010ENT\"  "setup.exe"  "/adminfile C:\MSOCache\All Users\2010-laptop.msp /Config K:\APPS\MSOffice2010ENT\MST\config-install.xml"

Open in new window


if that doesn't work you can create another batch to call your install batch in the background:
START /B CMD /C CALL "install.bat"  >NUL 2>&1

Open in new window

Thanks,

Did that nothing happened.
setupfile, config file are in application bundle.
2010-laptop.msp  is inside MDT application and also in ALL users folder.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Additionally, if you want to verify the output, you can add PAUSE at the end of your script, and it will add a "Press any key to continue . . . " prompt at the end.
Thanks
David:Exit did not work
Are you starting the batch file from another batch file? If so use "call" to start it, for example "Call BatchfileName.bet"
Thanks David,

It did close but it took around 25 minutes, Is there anything I can add?
Dj 3094,

Like I said earlier, try adding PAUSE on the line before EXIT.
Hi,

I'm not going to encourage *anyone* to use a BAT file.
Instead I am going to ask why are you copying the MSP file locally to the MSO cache? That is not in any description of how to install Office.
The MS method is to put your MSP files in the Updates folder of the Office source directory.

Ref: https://blogs.windows.com/itpro/2010/07/01/your-adding-office-2010-to-mdt-2010-environment-questions-answered/#xSQUeYJ5eLE7ETiR.97
or
Ref: https://blog.augustoalvarez.com.ar/2011/01/16/deploying-windows-7-office-2010-using-microsoft-deployment-toolkit-mdt-2010-part-ii/

You then put the XMLconfig in the root and that's it.
In MDT your installer becomes "Setup.exe". No BAT file required.

It's time to delete your batch files.

Mike