Is there a command line command for verifying what version of .NET is installed

前端 未结 9 892
孤街浪徒
孤街浪徒 2020-12-07 16:44

I have set of scripts for doing scripted installs. You can use the scripts on any server 2008 machine. However, I need to check if .NET 3.5 has been installed (before the

9条回答
  •  忘掉有多难
    2020-12-07 17:01

    you can check installed c# compilers and the printed version of the .net:

    @echo off
    
    for /r "%SystemRoot%\Microsoft.NET\Framework\" %%# in ("*csc.exe") do (
        set "l="
        for /f "skip=1 tokens=2 delims=k" %%$ in ('"%%# #"') do (
            if not defined l (
                echo Installed: %%$
                set l=%%$
            )
        )
    )
    
    echo latest installed .NET %l%
    

    the csc.exe does not have a -version switch but it prints the .net version in its logo. You can also try with msbuild.exe but .net framework 1.* does not have msbuild.

提交回复
热议问题