1.

Solve : Batch commands for 32 or 64bit?

Answer»

How would I WRITE a BATCH that allowed for registry uninstall by OS.

example:
32bit_wsam
"C:\Program Files\Juniper Networks\Secure Application Manager\UninstallSAM.exe"
32bit_networkconnect
"C:\Program Files\Juniper Networks\Network Connect 6.5.0\uninstall.exe"

64bit_wsam
"C:\Program Files (x86)\Juniper Networks\Secure Application Manager\UninstallSAM.exe"
64bit_networkconnect
"C:\Program Files (x86)\Juniper Networks\Network Connect 6.5.0\uninstall.exe"Please be a little more specific about what you are looking for. Do you have listed the uninstall programs and you WANT a batch to run them depending on WHETHER the OS is 32 or 64 bit? Or are you trying to figure out what a good uninstall string using registry values would be?To check 32 or 64 bit system, you will want to use a FOR command against the SYSTEMINFO command. Here's a basic skeleton of what you want:

Code: [Select]@echo off
setlocal enabledelayedexpansion
set errorcheck=0

for /f "tokens=1* delims=:" %%G in ('systeminfo /fo list') do (
echo %%G | find "System Type" >nul
if not errorlevel !errorcheck! (
echo %%H | find "64" >nul
if not errorlevel !errorcheck! (
start 64 bit uninstalls
) else (
start 32 bit uninstalls
)
) else (
set errorcheck=!errorlevel!
)
)
This code checks the systeminfo command (try using the command to see what it does) and checks the title of the information for system type. Once found it checks the rest of the line for 64 and executes the uninstalls based on what is found. Please post if you run into any problems.Sorry, found a small error. Need to adjust for a line right after the first IF line and move the last set errorcheck outside the IF. Check:

Code: [Select]@echo off
setlocal enabledelayedexpansion
set errorcheck=0

for /f "tokens=1* delims=:" %%G in ('systeminfo /fo list') do (
echo %%G | find "System Type" >nul
if not errorlevel !errorcheck! (
set errorcheck=!errorlevel!
echo %%H | find "64" >nul
if not errorlevel !errorcheck! (
start 64 bit uninstalls
) else (
start 32 bit uninstalls
)
)
set errorcheck=!errorlevel!
)



Discussion

No Comment Found