lundi 29 juin 2015

Errorlevel is different

I've been trying to write this batch script. What I want it to do is open msinfo.exe, then using the wmic check the manufacturer & depending on the manufacturer it will open that manufacturers website. Here's what I have written all ready without success:

@echo off

start %windir%\System32\msinfo32.exe

if exist c:\BIOS.txt (
      start c:\BIOS.txt
) else (
      wmic /output:c:\BIOS.txt bios get smbiosbiosversion
)

:asus

wmic /output:c:\Manufacturer.txt Computersystem get Manufacturer | FINDSTR "asus" > NUL

if %errorlevel% equ 1 (
      %programfiles%\Internet Explorer\iexplore.exe" **place support site here**
      goto exit
) else (
      goto dell
)

:dell

wmic /output:c:\Manufacturer.txt Computersystem get Manufacturer | FINDSTR "dell" > NUL

if %errorlevel% equ 1 (
      "%programfiles%\Internet Explorer\iexplore.exe" **place support site here**
      goto exit
) else (
      goto gateway
)

:gateway

wmic /output:c:\Manufacturer.txt Computersystem get Manufacturer | FINDSTR "gateway" > NUL

if %errorlevel% equ 1 (
      "%programfiles%\Internet Explorer\iexplore.exe" **place support site here**
      goto exit
) else (
      goto hp
)

:hp

wmic /output:c:\Manufacturer.txt Computersystem get Manufacturer | FINDSTR "hewlett-packard" > NUL

if %errorlevel% equ 1 (
      "%programfiles%\Internet Explorer\iexplore.exe" **place support site here**
      goto exit
) else (
      goto lenovo
)

:lenovo

wmic /output:c:\Manufacturer.txt Computersystem get Manufacturer | FINDSTR "lenovo" > NUL

if %errorlevel% equ 1 (
      "%programfiles%\Internet Explorer\iexplore.exe" **place support site here**
      goto exit
) else (
      goto samsung
)

:samsung

wmic /output:c:\Manufacturer.txt Computersystem get Manufacturer | FINDSTR "samsung" > NUL

if %errorlevel% equ 1 (
      "%programfiles%\Internet Explorer\iexplore.exe" **place support site here**
      goto exit
) else (
      goto sony
)

:sony

wmic /output:c:\Manufacturer.txt Computersystem get Manufacturer | FINDSTR "sony" > NUL

if %errorlevel% equ 1 (
      "%programfiles%\Internet Explorer\iexplore.exe" **place support site here**
      goto exit
) else (
      goto toshiba
)

:toshiba

wmic /output:c:\Manufacturer.txt Computersystem get Manufacturer | FINDSTR "toshiba" > NUL

if %errorlevel% equ 1 (
      "%programfiles%\Internet Explorer\iexplore.exe" **place support site here**
      goto exit
) else (
      goto exit
)

:exit

Any help with making me understand would be greatly appreciated. Everything I'm reading & trying just isn't getting me results. I've read everything on here about errorlevel & I guess it's not making sense?

Aucun commentaire:

Enregistrer un commentaire