/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


batch script to check and install dotnet4.0

08/11/2011 20145 views
Hi,
I have to make a .cmd or .bat script to check whether dotnet4.0 is installed or not. If its not installed then Install other wise exit out...
I need help in writing the .bat script. Here I did as below. but didn't worked.. plz let me know bcoz tomorrow it the date to submit it.....


::Check for DotNet 4.0 Install
Start /B /I /WAIT REG QUERY HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\1033
IF %ErrorLevel% EQU 0 (
@ECHO %DATE% - %TIME% : DotNet4.0 already installed
Goto :SkipDotNet
)
::Install DotNet 4.0 Install
Start /B /I /WAIT dotNetFx40_Client_x86_x64.exe /q /norestart
:SkipDotNet
0 Comments   [ + ] Show comments

Comments


Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

All Answers

0
Hi,

sorry for necro-posting but I had the same problem. Here's the solution :

setlocal enabledelayedexpansion
set g_strInternalOutputFullFilename=%TEMP%\Output.log

REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP" /s|FIND "v4" > "!g_strInternalOutputFullFilename!"
IF %ErrorLevel% EQU 0 (
    echo DotNet4.0 already installed
Goto :SkipDotNet
) else (
    echo .NET not installed
)
::Install DotNet 4.0 Install
Start /B /I /WAIT dotNetFx40_Client_x86_x64.exe /q /norestart
:SkipDotNet

Answered 10/15/2015 by: nolme
White Belt

0
For a more generic vbscript to detect dot net versions you can look here:

https://www-secure.symantec.com/connect/articles/detecting-which-net-frameworks-are-installed-using-vbscript

Answered 10/16/2015 by: EdT
Red Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ