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

Please log in to comment

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

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

Please log in to comment
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

Please log in to comment
Answer this question or Comment on this question for clarity