mattb47

Install-Dot-Net-3.5-from-Command-Line.bat

Aug 15th, 2025
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.64 KB | Fixit | 0 0
  1. @echo off
  2. rem
  3. rem Install .NET 3.5 on Windows 8-11, and Server 2012-2025
  4. rem
  5. rem Based on batch file from:
  6. rem https://www.majorgeeks.com/files/details/install_the_microsoft_net_framework_3_5_offline_in_windows_10.html
  7. rem
  8. rem Updated and expanded by Matthew Borcherding
  9. rem 08-15-2025
  10.  
  11.    Title .NET Framework 3.5 Installer
  12.    
  13.    setlocal
  14.  
  15.    rem
  16.   rem Check all drives (B through Z) for \sources\install.wim.
  17.   rem If found, use this as the source to install .NET 3.5
  18.   rem
  19.    
  20.    for %%I in (B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist "%%I:\\sources\install.wim" set setupdrv=%%I
  21.    
  22.    if defined setupdrv goto setupdrv-found
  23.    
  24.    :no-setupdrv
  25.       echo No installation media found!
  26.       echo Attempting to download and install from Microsoft instead...
  27.       echo.
  28.          
  29.       reg add "HKLM\software\Microsoft\Windows\CurrentVersion\Policies\Servicing" /v RepairContentServerSource /t REG_DWORD /d 00000002 /f
  30.          
  31.       echo Restarting Windows Update...
  32.          
  33.       net stop "Windows Update"
  34.       net start "Windows Update"
  35.      
  36.       echo Installing .NET Framework 3.5.  This can take a while...
  37.       echo.
  38.          
  39.       DISM /Online /Enable-Feature /FeatureName:NetFx3 /All
  40.       echo.
  41.       goto end
  42.    
  43.    
  44.     :setupdrv-found
  45.        echo Found Windows installation source on drive %setupdrv%...
  46.        echo.
  47.        echo Installing .NET Framework 3.5.  This can take a while...
  48.        echo.
  49.        
  50.        Dism /online /enable-feature /featurename:NetFX3 /All /Source:%setupdrv%:\sources\sxs /LimitAccess
  51.        
  52.    
  53.      
  54.      
  55. :end     
  56.    echo.
  57.    echo .NET Framework 3.5 should now be installed.
  58.    echo.
  59.    
  60.    pause
Advertisement
Add Comment
Please, Sign In to add comment