0

I am working on product testing automation. I just want to ask is there anyway to check that product has installed successfully by using Batch script?

I am using Win7 64-bit.

GEOCHET
  • 20,623
  • 15
  • 71
  • 98
Liverpool
  • 101
  • 5
  • 12

2 Answers2

2

It depends on the way your product installs. Your check script could check for the existence of files:

IF EXIST filename (
    REM Do one thing
) ELSE (
    REM Do another thing
)

(from How to check if a file exists from inside a batch file)

You could also check for registry keys, for example:

REG QUERY HKLM\Software\Microsoft\Office

will output something like:

HKEY_LOCAL_MACHINE\Software\Microsoft\Office\12.0
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Excel
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\MS Project
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Outlook

depending on what's installed on your computer.

(from Reading child registry key from regedit in batch file)

There are numbers of options, it's better if you can modify/work with the internals of your the installer to know what to check for.

Community
  • 1
  • 1
マルちゃん だよ
  • 1,654
  • 3
  • 17
  • 25
2

See if your installer returns an errorlevel. Errorlevel zero is generally an indicator of success

@echo off
setup.exe /switches
if not errorlevel 1 echo installation succeeded.
foxidrive
  • 37,659
  • 8
  • 47
  • 67