Advertisement
FocusedWolf

Windows 10: Install .Net 3.5 offline from installation media

Apr 3rd, 2019
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.46 KB | None | 0 0
  1. @echo off
  2.  
  3. :: SOURCE: https://winaero.com/blog/offline-install-of-net-framework-3-5-in-windows-10-using-dism/
  4. ::
  5. :: USAGE: Plug your Windows 10 USB stick in (or mount the Windows 10 .iso file) and run this script with admin privileges.
  6. ::        It will search for the install media and install .Net 3.5 from it.
  7. ::
  8. :: NOTE: The reason for this script is because "dotnetfx35.exe", the official offline installer for .Net 3.5, still requires internet access.
  9.  
  10. :CheckPermissions
  11.     setlocal
  12.  
  13.     fltmc >nul 2>&1 && (
  14.         goto :Work
  15.     ) || (
  16.         echo Error: This script requires administrator privileges.
  17.         echo.
  18.         echo Right click this scripts icon and select "Run as Administrator".
  19.         echo.
  20.  
  21.         goto :End
  22.     )
  23.  
  24.     endlocal & goto :eof
  25.  
  26. :Work
  27.     Title .NET Framework 3.5 Offline Installer
  28.  
  29.     for %%I in (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
  30.  
  31.     if defined setupdrv (
  32.         echo Found installation media on drive %setupdrv%
  33.         echo.
  34.         echo Installing .Net Framework 3.5...
  35.         Dism /online /enable-feature /featurename:NetFX3 /All /Source:%setupdrv%:\sources\sxs /LimitAccess
  36.         echo.
  37.         echo .Net Framework 3.5 installation complete...
  38.         echo.
  39.     ) else (
  40.         echo No installation media found!
  41.         echo Insert DVD or USB flash drive and run this file once again.
  42.         echo.
  43.     )
  44.  
  45. :End
  46.     pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement