DosTips.com

A Forum all about DOS Batch
It is currently 27 Jul 2016 11:18

All times are UTC-06:00




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Help With Batch File
PostPosted: 20 Jun 2012 04:03 
Offline

Joined: 20 Jun 2012 03:51
Posts: 3
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


Top
   
 Post subject: Re: Help With Batch File
PostPosted: 20 Jun 2012 04:42 
Offline

Joined: 21 Nov 2010 08:07
Posts: 233
Location: At My Computer
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 ..


Top
   
 Post subject: Re: Help With Batch File
PostPosted: 20 Jun 2012 05:05 
Offline

Joined: 20 Jun 2012 03:51
Posts: 3
I am unstalling Office XP professional and installing Office XP standard version.
So I have to Unstall XP professional first.


Top
   
 Post subject: Re: Help With Batch File
PostPosted: 20 Jun 2012 05:37 
Offline
Expert

Joined: 10 Feb 2012 02:20
Posts: 5811
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
)


Top
   
 Post subject: Re: Help With Batch File
PostPosted: 20 Jun 2012 06:17 
Offline

Joined: 21 Nov 2010 08:07
Posts: 233
Location: At My Computer
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:
@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


Top
   
 Post subject: Re: Help With Batch File
PostPosted: 20 Jun 2012 06:20 
Offline

Joined: 20 Jun 2012 03:51
Posts: 3
Thanks That works!


Top
   
 Post subject: Re: Help With Batch File
PostPosted: 20 Jun 2012 06:40 
Offline
Expert

Joined: 23 Dec 2011 13:59
Posts: 3147
You were able to uninstall a version of office and install a new version of office in 3 minutes flat?


Top
   
 Post subject: Re: Help With Batch File
PostPosted: 20 Jun 2012 07:31 
Offline

Joined: 21 Nov 2010 08:07
Posts: 233
Location: At My Computer
No Problem, just curious are you doing the Silent Install for Office Standard where its pre-activated etc.? 8)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: Yahoo [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited