Page 1 of 1

Help With Batch File

Posted: 20 Jun 2012 04:03
by T_Arora
I am trying to write a batch file that will take a version of Office XP and install another version.
I am able to do both.
My problem is that i dont what the installation to happen if the Uninstallation did not happen.
Pls let me know if their is a way to check if the command was successful.

The i am using is provided below:

\\ *Ms Office XP Unstallation Command Here*
@echo off
echo ................
timeout 120
cls
\\ *MS Office XP installation Command Here*
exit

Re: Help With Batch File

Posted: 20 Jun 2012 04:42
by Dos_Probie
normally office will just upgrade what you have, what version of office
are you uninstalling?, also ms has a officescrub.vbs file that you could call
from your batch then proceed with the new install ..

Re: Help With Batch File

Posted: 20 Jun 2012 05:05
by T_Arora
I am unstalling Office XP professional and installing Office XP standard version.
So I have to Unstall XP professional first.

Re: Help With Batch File

Posted: 20 Jun 2012 05:37
by foxidrive
Check if the installer or uninstaller returns an errorlevel result code.

You can then use the errorlevel to determine what to do.


uninstall command
if not errorlevel 1 (
install commands
)

Re: Help With Batch File

Posted: 20 Jun 2012 06:17
by Dos_Probie
Ok so you are doing a downgrade, have not used xp in years so cant vertify officexp registry location but
you could do the error level as suggested via a reg query as follows
Untested but you can get general idea

Code: Select all

@echo off
:Ck for O2Pro First
 reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProductName% 1>> "%LogLocation%\%computername%.txt" 2>>&1
 set Level=%ErrorLevel%
 echo Error Level=%Level%  >> "%LogLocation%\%computername%.txt"
 if %Level%==0 (goto End) else (goto OfficeStd)
 
REM If 1 returned, the product was not found. Run setup here.
 :OfficeStd
 "%DeployStd%\setup.exe" 1>> "%LogLocation%\%computername%.txt" 2>>&1
 echo %date% %time% Setup ended with error code %errorlevel%. >> "%LogLocation%\%computername%.txt"
 
REM If 0 or other was returned, the product was found or install was succesfull.
 :End

Re: Help With Batch File

Posted: 20 Jun 2012 06:20
by T_Arora
Thanks That works!

Re: Help With Batch File

Posted: 20 Jun 2012 06:40
by Squashman
You were able to uninstall a version of office and install a new version of office in 3 minutes flat?

Re: Help With Batch File

Posted: 20 Jun 2012 07:31
by Dos_Probie
No Problem, just curious are you doing the Silent Install for Office Standard where its pre-activated etc.? 8)