Can't get the install to work

July 9, 2013 at 20:17:49
Specs: windows xp
For some reason when I try to run this batch script that is designed to go out and check out a system for installed software and install/upgrade software it does everything but run the install.

However, if I run the commands manually in the batch file everything works. Can anyone assist me with what might be wrong here

@echo off

SETLOCAL ENABLEDELAYEDEXPANSION
If Exist c:\prog.txt Del c:\prog.txt
If Exist c:\installer-check.txt Del c:\installer-check.txt

:: Read registry for installed programs, use this to setup
regedit /e c:\regexport.txt "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall"
REM echo STOP HERE unless batch file has already been setup.
REM echo To setup rest of batch file open c:\regexport to find the display name and version of installed programs.
REM echo Do this on a computer with all the wanted software already installed and at latest version.
REM echo If this has already been setup then continue with program.
pause

:: PROGRAM 1 CHECK START
:: Find if program is installed and check if the version number exists
find /C "Windows Internet Explorer 8" c:\regexport.txt >c:\prog.txt
for /f "tokens=3" %%p in (c:\prog.txt) do set prog1install=%%p
Del c:\prog.txt

find /C "20090308.140743" c:\regexport.txt >c:\prog.txt
for /f "tokens=3" %%p in (c:\prog.txt) do set prog1version=%%p
Del c:\prog.txt

:: Write to file if program is installed or not and if it's up to latest version
IF "%prog1install%" NEQ "0" (
IF "%prog1version%" NEQ "0" (
echo UPDATE:NO 'Internet Explorer 8' is installed and at latest version >>c:\installer-check.txt
) ELSE (
echo UPDATE:YES 'Internet Explorer 8' is installed but not at latest version >>c:\installer-check.txt
)
) ELSE (
echo UPDATE:YES 'Internet Explorer 8' is not installed >>c:\installer-check.txt
)
:: PROGRAM 1 CHECK END

:: PROGRAM 2 CHECK START
:: Find if program is installed and check if the version number exists
find /C "Microsoft .NET Framework 4 Client Profile" c:\regexport.txt >c:\prog.txt
for /f "tokens=3" %%p in (c:\prog.txt) do set prog1install=%%p
Del c:\prog.txt

find /C "4.0.30319" c:\regexport.txt >c:\prog.txt
for /f "tokens=3" %%p in (c:\prog.txt) do set prog1version=%%p
Del c:\prog.txt

:: Write to file if program is installed or not and if it's up to latest version
IF "%prog1install%" NEQ "0" (
IF "%prog1version%" NEQ "0" (
echo UPDATE:NO '.Net Framework 4' is installed and at latest version >>c:\installer-check.txt
) ELSE (
echo UPDATE:YES '.Net Framework 4' is installed but not at latest version >>c:\installer-check.txt
)
) ELSE (
echo UPDATE:YES '.Net Framework 4' is not installed >>c:\installer-check.txt
)
:: PROGRAM 2 CHECK END

:: PROGRAM 3 CHECK START
:: Find if program is installed and check if the version number exists
find /C "Epic 2012 Hyperspace" c:\regexport.txt >c:\prog.txt
for /f "tokens=3" %%p in (c:\prog.txt) do set prog1install=%%p
Del c:\prog.txt

find /C "79.0.0.0" c:\regexport.txt >c:\prog.txt
for /f "tokens=3" %%p in (c:\prog.txt) do set prog1version=%%p
Del c:\prog.txt

:: Write to file if program is installed or not and if it's up to latest version
IF "%prog1install%" NEQ "0" (
IF "%prog1version%" NEQ "0" (
echo UPDATE:NO 'Epic 2012 Hyperspace' is installed and at latest version >>c:\installer-check.txt
) ELSE (
echo UPDATE:YES 'Epic 2012 Hyperspace' is installed but not at latest version >>c:\installer-check.txt
)
) ELSE (
echo UPDATE:YES 'Epic 2012 Hyperspace' is not installed >>c:\installer-check.txt
)
:: PROGRAM 3 CHECK END

:: Add more program checks here

:: Open file listing which programs are installed or not and if they have latest version
start notepad c:\installer-check.txt

pause

:: If outdated install program

net use z: \\Server\software$\ops

for /f "tokens=1,2 delims= " %%a in (c:\installer-check.txt) do (

:: Check if update needed, if so begin installation
IF "%%a"=="UPDATE:YES" (
IF "%%b"=="'Internet Explorer 8'" (
pushd z:
cscript ie8.vbs
popd
Continue batch program after installation finished
pause
)
)

:: Check if update needed, if so begin installation
:: IF "%%a"=="UPDATE:YES" (
:: IF "%%b"==".Net Framework 4" (
:: pushd \\server\software$\Ops
:: wscript \\server\software$\Ops\dotNetFx40_Full_setup.exe
:: :: Continue batch program after installation finished
:: pause
:: )
:: )

:: Check if update needed, if so begin installation
IF "%%a"=="UPDATE:YES" (
IF "%%b"=="Epic 2012 Hyperspace" (
pushd z:
cscript epic2012.vbs
popd
:: Continue batch program after installation finished
pause
)
)

:: Add more installation checks to match number of program checks in beginning of batch file
)

pause

net use z: /delete

exit


See More: Cant get the install to work

Report •


#1
July 9, 2013 at 21:54:18
Well, if you get any error message, please post content thereof.
Aside from that, my only suggestion is to use debugging-reports to tell you what's going on at key point(s): and since it's failing at the cscript invocation, then obviously put echo/pause in front of that, then within the cscript, also debug-report what the cscript is seeing (such as working directory, file availability etc). If it works one way (batch) and not the other (cmd sequence), then I would hazard a guess its something to do with local environment, but only some tests will uncover what's going on. I do know that paths can be a real pain, so fully qualify them and double-quote them.

Report •
Related Solutions


Ask Question