@echo off setlocal title Win10_Net3.5_离线安装脚本_by豆芽 mode con: cols=60 lines=10 set "SCRIPT_DIR=%~dp0" set "DOWNLOAD_DIR=%SCRIPT_DIR%douya" set "INSTALLER_NAME=net3.5离线安装程序.exe" set "INSTALLER_PATH=%DOWNLOAD_DIR%\%INSTALLER_NAME%" set "DOWNLOAD_URL=http://s.6p7p.com/kk/net/dotnetfx3.5_X86_X64.exe" if not exist "%DOWNLOAD_DIR%" ( echo 正在创建下载目录:%DOWNLOAD_DIR% mkdir "%DOWNLOAD_DIR%" ) echo 正在下载 .NET 3.5 离线安装程序,请稍候... bitsadmin /transfer "DownloadNet35" /priority FOREGROUND "%DOWNLOAD_URL%" "%INSTALLER_PATH%" if not exist "%INSTALLER_PATH%" ( echo 下载失败,请检查网络连接或下载地址! pause exit /b 1 ) echo 下载完成,开始静默安装... "%INSTALLER_PATH%" /verysilent /norestart if %errorLevel% equ 0 ( echo. echo ==================================== echo .NET 3.5 安装成功! echo ==================================== echo. ) else ( echo. echo .NET 3.5 安装失败,错误代码:%errorLevel% echo. ) echo 正在清理安装源文件... if exist "%INSTALLER_PATH%" ( del /f /q "%INSTALLER_PATH%" ) if exist "%DOWNLOAD_DIR%" ( rmdir /s /q "%DOWNLOAD_DIR%" ) echo 清理完成! pause endlocal