batch to check for mutiple conditions of Office, and do something on specific output

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
m0b1l3us3r
Posts: 4
Joined: 06 Mar 2016 01:12

batch to check for mutiple conditions of Office, and do something on specific output

#1 Post by m0b1l3us3r » 06 Mar 2016 01:33

Hi all,
i found on this great forum, the solution for the first part of what i need to do, that is check for multiple conditions of office,
here is the topic and the script,

Code: Select all

http://www.dostips.com/forum/viewtopic.php?t=5383


the script i choose is this,

Code: Select all

@Echo off&SetLocal
Set "KEY="&Set "GUID="&Set "IOV="&Set "MWB=32"&Set "MOB=32"
Echo=%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%|Find "64">Nul&&(
   Set "KEY=\Wow6432Node"&Set "MWB=64")
Set "KEY=HKLM\Software%KEY%\Microsoft\Windows\CurrentVersion\Uninstall"
For /f "Delims=" %%a In ('Reg Query %KEY% /k /f "*-001B-*0FF1CE}"') Do (
   If Not Defined GUID Set "GUID=%%~nxa")
If Not Defined GUID (Echo=Unable to find Office Product&GoTo :EndIt)
If %GUID:~20,1% Equ 1 Set "MOB=64"
If %GUID:~4,1% Equ 4 (Set IOV=10) Else (If %GUID:~4,1% Equ 2 (Set IOV=07) Else (
      If %GUID:~4,1% Equ 5 (Set IOV=13) Else (Set IOV=??)))
Echo=&Echo= Office 20%IOV% %MOB%-bit Product installed on a %MWB%-bit OS
:EndIt
TimeOut /t 5 1>Nul


Now i need to do some other stuff only if the output is
Office 2007 32-bit Product installed on a 64-bit OS

My intention is to upgrade my office suite on multiple PC via a network share,
and i would like to install on a clean situation, so first of all , want to check if office 32 bit is installed on OS 64 bit,
if office 32 bit is installed on OS 64, i want to remove it, and install office 64 bit.
i already have configured my script that can uninstall all version of office, based on ProductID, but as i stated before i would like to call the uninstall script only if office 32 is on 64 bit OS.
Could you please edit this script to call my second script based on that output?

Thanks in advance.
Regards

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: batch to check for mutiple conditions of Office, and do something on specific output

#2 Post by foxidrive » 06 Mar 2016 02:59

m0b1l3us3r wrote:Now i need to do some other stuff only if the output is
Office 2007 32-bit Product installed on a 64-bit OS

if office 32 bit is installed on OS 64, i want to remove it, and install office 64 bit.


The word on the street is that Office 2010 is the first release with 64 bit, and so all Office 2007 are 32 bit versions.

http://forums.anandtech.com/showpost.ph ... stcount=11

m0b1l3us3r
Posts: 4
Joined: 06 Mar 2016 01:12

Re: batch to check for mutiple conditions of Office, and do something on specific output

#3 Post by m0b1l3us3r » 06 Mar 2016 04:28

Hi foxidrive
yes i already new that the first office is the 2010 version,

foxidrive wrote:
m0b1l3us3r wrote:The word on the street is that Office 2010 is the first release with 64 bit, and so all Office 2007 are 32 bit versions.

http://forums.anandtech.com/showpost.ph ... stcount=11


but i have on multiple PC's installed,
Office 2007 (Outlook+Word+Excel+PowerPoint) X32
Office 2010 (Visio Pro + Project Pro) X64,
and i need to remove all these staff to install office 365 x64,
can you help implement this script?
Thanks a lot in advance.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: batch to check for mutiple conditions of Office, and do something on specific output

#4 Post by foxidrive » 06 Mar 2016 07:18

m0b1l3us3r wrote:yes i already new that the first office is the 2010 version,

but i have on multiple PC's installed,
Office 2007 (Outlook+Word+Excel+PowerPoint) X32
Office 2010 (Visio Pro + Project Pro) X64,
and i need to remove all these staff to install office 365 x64,


Your question didn't mention updating to the latest release. Why not just update every one?

m0b1l3us3r
Posts: 4
Joined: 06 Mar 2016 01:12

Re: batch to check for mutiple conditions of Office, and do something on specific output

#5 Post by m0b1l3us3r » 06 Mar 2016 11:25

foxidrive wrote:
Your question didn't mention updating to the latest release. Why not just update every one?


We bought new software and need to update, and we must do it on a clean situation,
that means that, if i wont to install office 64bit, on a system x64 where there is installed office 32 bit, the installation will fail.

m0b1l3us3r
Posts: 4
Joined: 06 Mar 2016 01:12

Re: batch to check for mutiple conditions of Office, and do something on specific output

#6 Post by m0b1l3us3r » 07 Mar 2016 05:17

Never mind found the solution.
Thanks.

Post Reply