/build/static/layout/Breadcrumb_cap_w.png

batch script to check and install dotnet4.0

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

Answers (2)

Posted by: nolme 8 years ago
White Belt
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

Posted by: EdT 8 years ago
Red 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

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
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