[wpkg-users] automating MS Windows Script installation

Andrew Z andrewz at springsrescuemission.org
Wed Dec 14 17:57:00 CET 2005


Antonio Calvo Rodriguez wrote:

> I'm using wpkg under active directory policy with a mix of windows 
> 2000 and XP computers.
> Updating the scripting engine is easy, just include the installer in 
> the start.bat launched by the GP. as in tje example below.
> If i recall correctly wpkg doesn't support windows version bellow 
> windows 2000
> ---- Star.bat ---
> @echo off
> goto :inicio

-------- 
>
> ::
> ::  Nombre:          WPKG_Vigo1.bat
> ::  Autor:           Antonio Calvo Rodriguez
> ::  Actualizaciones: a.calvo at alcampo.es
> ::
> ::  Hecho/Probado en:Windows XP
> ::  Requiere:        OS: Windows 2000 o XP
> ::                   API:Windows scripting host 5.6
> ::
> ::  Main Function:   Arranca el instalador de paquetes wpkg
> ::                   En caso de no tener instalado cscript o tener una
> ::                   version inferior a 5.6 lo instala previamente
> ::
> ::
> ::  Syntax:          WPKG_Vigo1.bat
> ::
> ::  Uso y notas:
> ::                   Antes de su uso deben definirse las variables
> ::                   de entorno
> ::
> ::
> ::  Asunciones &
> ::  Limitaciones:
> ::
> ::  Documentacion:   In the script
> ::
> ::  Licencia:        GNU General Public License see "license.txt" or
> ::                   http://www.gnu.org/copyleft/gpl.html
> ::
> ::  Version:         1.0
> ::
> ::  Revision History:
> ::        10/12/05 - 1.0 - 1º version
> ::

-------- 
>
>
> :inicio
> SETLOCAL ENABLEEXTENSIONS
>
> :: Definicion de las variables de entorno
> :: Servidor y carpeta compartida donde residen wpkg y los paquetes
> set WPKGROOT=\\i030021\adm$\bin
> set PACKAGES=\\i030021\adm$\pkg
>
> :: Localizacion del instalador de windows scripting 5.6
> set WSH=\\i030021\adm$\pkg\scriptes.exe
>
> :: Comprobacion e instalacion de windows scripting
>
> :: Windows XP tiene la version correcta en c:\windows
> if exist c:\windows\system32\cscript.exe goto :OK
>
> :: Para Windows 2000
> :: Si no existe cscript instalamos directamente
> if not exist c:\winnt\system32\cscript.exe %WSH% /q:a /r:n
>
> :: Comprobamos la version e instalamos si no es la correcta
> c:\winnt\system32\cscript.exe | find "5.6"
> if ERRORLEVEL 1  %WSH% /q:a /r:n


Antonio,

Thank you.  I came up with  the following, and early testing shows it
works on Windows 95 and 2000.


@echo off
REM License: General Public License http://www.gnu.org/copyleft/gpl.html
REM Purpose: Installs or upgrades Windows Scripting Host as appropriate

REM old refers to Windows 9x, ME, NT
REM new refers to Windows 2000, XP
set WSH_OLD=\\server\public\software\windows\scr56en.exe
set WSH_NEW=\\server\public\software\windows\scriptEN.exe
setlocal
cls

VER | FIND "Windows 2000" > nul
IF not errorlevel 1 GOTO Win_2000XP

VER | FIND "98" > nul
IF not errorlevel 1 GOTO Win_9xME

VER | FIND "ME" > nul
IF not errorlevel 1 GOTO Win_9xME

VER| FIND "95" > nul
IF not errorlevel 1 GOTO Win_9xME

goto Win_unknown

:Win_2000XP
echo You are running Windows 2000 or XP
if not exist %windir%\system32\cscript.exe %WSH_NEW% /q:a /r:n
cscript.exe | find "5.6"  > nul
if errorlevel 1 %WSH_NEW% /q:a /r:n
goto end

:Win_9xME
echo You are running Windows 95, 98, or ME
cscript | find "5.6"
if errorlevel 1 %WSH_OLD% /q:a /r:n
goto end

:Win_unknown
echo "ERROR: Your Windows version is unknown!"

:end
REM pause is for debugging
pause




Andrew




wpkg-users mailing list
wpkg-users at lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/wpkg-users




More information about the wpkg-users mailing list