-1

I want to automate my ms office installation 2007 or 2010 running a batch file.

I am thinking having an options menu 1.Office 2007 2.Office2010

When started I want my timer to start..lets say 20secs

if I press in the meantime Option 2 start installing 2010

if left and timeout = 0 start installing 2007

@echo off
timeout /t 20
choice /n /c 2 /m "Press 2 for Office 2010 "
set /a m=2
set /a counter=0
if %counter% ==0 GOTO office2007
if %M%==2 GOTO office2010

:office2010
cd %windir%\system32\office2010.exe
start setup2010.exe

:office2007
cd %windir%\system32\office2007.exe
start setup007.exe

but I think its totally wrong approach

any help?

2 Answers2

1

See choice /? in a cmd window or read choice

:: Q:\Test\2017\08\31\SF_871434.cmd
@echo off
:loop
Cls
Echo Select office version to install
Echo(
Echo   [1]  Install Microsoft Office 2007
Echo   [2]  Install Microsoft Office 2010
Echo(
CHOICE.exe /N /C 12 /D 1 /T 20 /M "after 20 seconds delay defaults to [1] "
If ErrorLevel 2 Goto :office2010
If ErrorLevel 1 Goto :office2007
Goto :loop

:office2010
cd %windir%\system32\office2010.exe
start setup2010.exe
Goto :Eof

:office2007
cd %windir%\system32\office2007.exe
start setup007.exe
Goto :Eof

Sample Screen output:

Select office version to install

  [1]  Install Microsoft Office 2007
  [2]  Install Microsoft Office 2010

after 20 secondss delay defaults to [1] 
LotPings
  • 1,015
  • 7
  • 12
0

In addition to that, I'd suggest you to consider to use the Office Customization Tool (do run it with 'setup.exe /admin' switch) to create a msp file that fully automates the setup.exe procedure as well.

Office 2007:

http://windowsitpro.com/windows/how-do-i-create-administrative-installation-microsoft-office-2007

Office 2010:

https://technet.microsoft.com/en-us/library/ff521767(v=office.14).aspx

MaCae
  • 21
  • 5