I am attempting to create a batch script that will detect the model of HP laptop, once the model is detected, the script will execute the proper BIOS to the laptop depending the model of the laptop.
So if the laptop is an HP elitebook 840 G1 then install this X BIOS. It laptop is HP elitebook 840 G2 then install Y bios, and so on.
I have found a command :WMIC CSPRODUCT GET NAME this outputs: Name HP EliteBook 840 G1
The script what I have so far is : @echo off
cls
SETLOCAL ENABLEDELAYEDEXPANSION
SET count=1
FOR /F "tokens=*" %%F IN ('WMIC CSPRODUCT GET NAME') DO (
SET var!count!=%%F
SET /a count=!count!+1)
SET v=%var2%
:;ECHO %var1%
ECHO %var2%
ENDLOCAL
:; Get version number only so drop off HP EliteBook 840
FOR /F "tokens=1-9 delims=K" %%A IN ("%var2%") DO (
SET V=%%a
echo %V%
)
The above code is not mine, I got it from:
How to set commands output as a variable in a batch file
This script so far what it does it takes the output of the command WMIC CSPRODUCT GET NAME
then stores it in a variable. I am stuck where to proceed after if model is X then install X BIOS.
Please assist me in completing this code. Much appreciated.