How to check nodejs is installed if not then install using batch script

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
danisharora
Posts: 1
Joined: 22 Jan 2017 03:14

How to check nodejs is installed if not then install using batch script

#1 Post by danisharora » 22 Jan 2017 03:38

How can i check whether nodejs is installed .if it not installed then how to install using batch script.

Code: Select all

REM ===================DEFINE MSI,MST,UPN,log file & folder here ==================
SET MSINAME=SETUP.MSI
SET MSTNAME=SETUP.MSI
sET UPN=AppID-Vendor-AppName-Version-ReleseVersion
SET LOGSFOLDER="C:\ApplicationLogs\%UPN%_Install.log"
IF NOT EXIST "C:\ApplicationLogs" MD "C:\ApplicationLogs"
REM ================================================================================
REM ===================Check if the Product exists already==========================
SET PRODUCTKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
REG QUERY %PRODUCTKEY%\{4ECF4BDC-8387-329A-ABE9-CF5798F84BB2}
IF NOT %ERRORLEVEL% EQU 0 (GOTO :INSTALL) ELSE GOTO :ENDHERE
REM ================================================================================
:INSTALL
REM =======================Install the application=================================
MSIEXEC.EXE /I "%~dp0SETUP.MSI" /TRANSFORMS="%~dp0SETUP.MST" /QB! /L*V "%LOGSFOLDER%"
set MSIERROR=%errorlevel%
if %MSIERROR%==0 GOTO :ENDHERE
if %MSIERROR%==1641 GOTO :ENDHERE
if %MSIERROR%==3010 GOTO :ENDHERE
GOTO :ERROR
REM ================================================================================
REM ================ Installation successful. Write to Event Log====================
:ENDHERE
EVENTCREATE /l Application /so %UPN%-Install-SUCCESS /t SUCCESS /id 1000 /d "Application installed successfully."
Exit 0
REM ================================================================================

REM ================ Installation failed. Write to Event Log========================
:ERROR
EVENTCREATE /l Application /so %UPN%-Install-FAILED--(ERROR=%MSIERROR%) /t ERROR /id 999 /d "Application installation failed."
Exit %MSIERROR%
REM ================================================================================

Post Reply