# Batch file to check installed frame work and install if not present



## corpsey1 (Dec 8, 2010)

Hi I've had a go at writing a batch script pretty much off the top of my head, and am wondering if I'm going in the right direction? I would like to keep it as close to my script as possible rather than completely change it to something I have no hope in understanding 

I know it's a dirty script but it's my first whack at something like this.

Here it goes:

@ECHO OFF

ECHO Checking for installed frameworks...

IF EXIST "%systemroot%\Microsoft.NET\Framework\v1.0.3705" ECHO Framework 1.0 already installed:

ELSE ECHO Installing Framework 1.0 

start /wait dotnetfx-1.0.exe /q:a /c:"install.exe /q"

IF EXIST "%systemroot%\Microsoft.NET\Framework\v1.1.4322" ECHO Framework 1.1 already installed:

ELSE ECHO Installing Framework 1.1

start /wait dotnetfx-1.1.exe /q:a /c:"install.exe /qb /l"

IF EXIST "%systemroot%\Microsoft.NET\Framework\v2.0.50727" ECHO Framework 2.0 already installed: 

ELSE ECHO Installing Framework 2.0

start /wait &#8220;dotnetfx-2.0.exe /q:a /c:&#8221;install /l /q&#8221;"

IF EXIST "%systemroot%\Microsoft.NET\Framework\v3.0" ECHO Framework 3.0 already installed:

ELSE ECHO Installing Framework 3.0

start /wait &#8220;dotnetfx-3.0-x86.exe /q /norestart&#8221;

IF EXIST "%systemroot%\Microsoft.NET\Framework\v3.5" ECHO Framework 3.5 already installed:

ELSE ECHO Installing Framework 3.5

start /wait "dotnetfx-3.5.exe /q /norestart"

IF EXIST "%systemroot%\Microsoft.NET\Framework\v4.0.30319" ECHO Framework 4.0 already installed:

ELSE ECHO Installing Framework 4.0

start /wait "dotnetfx-4.0.exe /passive"

ECHO Done!

EXIT



EDIT: By the way (although I'm sure you're aware) It's the "else" command that is giving me hassle, the "if exist" is fine


Thanks


----------



## corpsey1 (Dec 8, 2010)

Managed to sort it myself *proud* found out the need for brackets


----------



## Squashman (Apr 4, 2003)

Don't you mean parenthesis.


----------



## corpsey1 (Dec 8, 2010)

Nope I mean brackets, I'm British


----------

