[软件技巧] Windows一键重装系统为Linux (netboot,网络安装)
作者:CC下载站 日期:2019-10-29 13:52:21 浏览:2389 分类:玩电脑
文章核心内容转载自@萌咖大佬!
特别提醒:一键重装有一定的风险,请做好数据备份,做好抢救方案!
有些厂商的机器因策略问题,不支持Windows重装为Linux. 例如: 腾讯云非大陆区域.
有些厂商Windows系统盘会比Linux系统盘大,想要大一点系统盘. 例如: AZURE.
有些厂商不支持VNC,这对于转换系统实在不方便.
这篇文章可以解决以上问题.
使用前,请耐心看完文章.
如果造成损失,萌咖(原大佬)不负任何责任.
使用方法
下载 win32loader.bat (分流下载:https://pan.baidu.com/s/1UyEn7B4OPa7jmqANzPYHdQ). 双击打开此文件. 自行选择选项. 按回车重启,并等待安装完成.
注意事项
如果对提供安装的发行版不满意,请参考此文章:CentOS/Debian/Ubuntu网络重装系统一键脚本
默认提供的是Debian8(Jessie),添加了firmware包,提供了更多的驱动支持,DHCP模式一键.
非DHCP模式,如果要一键,则需要自己定制镜像.
定制Debian系镜像应该没问题,其他未作测试.
默认root账户密码 Vicer .
如需要Linux一键重装为Windows,请参考:
叒一个!一键全自动 DD 安装 Windows系统
Linux全自动一键DD安装Windows系统
如果厂商不支持VNC,则需要自己定制镜像.
定制方法参考上面提到的:CentOS/Debian/Ubuntu网络重装系统一键脚本
主要在镜像中添加机器的网络参数,以便支持一键安装.
命令示例:
bash InstallNET.sh -d 8 -v 64 -a --ip-addr <IP> --ip-mask <NetMask> --ip-gate <GATE> --loader |
完成后将 initrd.img
和 vmlinuz
存放到能直链下载的位置.
如果厂商支持VNC,则可以直选全部选 1 .
安装的时候,自己填 IP地址,子网掩码, 网关, DNS服务器.
DNS服务器推荐填: 8.8.8.8
区分是否为DHCP模式
非DHCP模式: 如上图,显示了详细的IP地址.(选项为:使用下面的IP地址)
DHCP模式: 参考上图.(选项为:自动获得IP地址)
源码备份
@ECHO OFF&PUSHD %~DP0 &TITLE Win32Loadersetlocal enabledelayedexpansion::Author MoeClub.orgcolor 87cd.>%windir%\GetAdminif exist %windir%\GetAdmin (del /f /q "%windir%\GetAdmin") else (echo CreateObject^("Shell.Application"^).ShellExecute "%~s0", "%*", "", "runas", 1 >> "%temp%\Admin.vbs""%temp%\Admin.vbs"del /s /q "%temp%\Admin.vbs"exit /b 2)cls echo * Init Win32Loader.set URL=https://moeclub.org/attachment/WindowsSoftware set download=0set try_download=1 :Initmkdir "%SystemDrive%\win32-loader" >NUL 2>NULif exist "%SystemDrive%\Windows\System32\WindowsPowerShell" (set use_ps=1) else (set use_ps=0) if %use_ps% equ 1 (goto InitIt) else (goto InitFail) :InitItset try_download=0powershell.exe -command "& {$client = new-object System.Net.WebClient; $client.DownloadFile('!URL!/g2ldr/g2ldr','%SystemDrive%\g2ldr')}" >NUL 2>NULpowershell.exe -command "& {$client = new-object System.Net.WebClient; $client.DownloadFile('!URL!/g2ldr/g2ldr.mbr','%SystemDrive%\g2ldr.mbr')}" >NUL 2>NULpowershell.exe -command "& {$client = new-object System.Net.WebClient; $client.DownloadFile('!URL!/g2ldr/grub.cfg','%SystemDrive%\win32-loader\grub.cfg')}" >NUL 2>NULgoto InitDone :InitFailecho Not found powershell, please download them by yourself.echo '%SystemDrive%\g2ldr'echo '%SystemDrive%\g2ldr.mbr'echo '%SystemDrive%\win32-loader\grub.cfg'echo Press [ENTER] when you finished.pause >NUL 2>NULgoto InitDone :InitDoneif !try_download! equ 0 (set InitOption=InitFail) else (set InitOption=Init)if not exist "%SystemDrive%\g2ldr" goto !InitOption!if not exist "%SystemDrive%\g2ldr.mbr" goto !InitOption!if not exist "%SystemDrive%\win32-loader\grub.cfg" goto !InitOption! :Imageecho.echo * Please select initrd mode.echo [1] Online downloadecho [2] Local filechoice /n /c 12 /m Select:if errorlevel 2 goto LocalModeif errorlevel 1 goto OnlineModegoto Image :OnlineModeecho.echo * Please select source.echo [1] by MoeClub (DHCP or VNC Support)echo [2] by yourselfchoice /n /c 12 /m Select:if errorlevel 2 goto Yourselfif errorlevel 1 goto MoeClubgoto OnlineMode:Yourselfecho.echo if 'initrd.img' URL is 'https://moeclub.org/onedrive/IMAGE/Loader/DebianJessie/initrd.img', Please input 'https://moeclub.org/onedrive/IMAGE/Loader/DebianJessie'.set /p IMG_URL=URL :if defined IMG_URL (goto Download) else (goto MoeClub):MoeClubset IMG_URL=https://moeclub.org/onedrive/IMAGE/Loader/DebianJessiegoto Download:Downloadif %use_ps% equ 1 (echo.echo Downloading 'initrd.img'...powershell.exe -command "& {$client = new-object System.Net.WebClient; $client.DownloadFile('!IMG_URL!/initrd.img','%SystemDrive%\win32-loader\initrd.img')}" >NUL 2>NULecho Downloading 'vmlinuz'...powershell.exe -command "& {$client = new-object System.Net.WebClient; $client.DownloadFile('!IMG_URL!/vmlinuz','%SystemDrive%\win32-loader\vmlinuz')}" >NUL 2>NULset download=1) else (echo Not support online download, auto change Local initrd.goto LocalMode) :LocalModeif !download! equ 0 (echo.echo Please put 'initrd.img' and 'vmlinuz' to '%SystemDrive%\win32-loader' .echo Press [ENTER] when you finished.pause >NUL 2>NUL) :Done0set download=0if exist "%SystemDrive%\win32-loader\initrd.img" (goto Done1) else (echo Not found '%SystemDrive%\win32-loader\initrd.img' .goto LocalMode) :Done1set download=0if exist "%SystemDrive%\win32-loader\vmlinuz" (goto Done) else (echo Not found '%SystemDrive%\win32-loader\vmlinuz' .goto LocalMode) :Doneecho.echo Press [ENTER] to reboot...pause >NUL 2>NULif not exist "%SystemDrive%\g2ldr" echo Not found '%SystemDrive%\g2ldr' . && exit 1if not exist "%SystemDrive%\g2ldr.mbr" echo Not found '%SystemDrive%\g2ldr.mbr' . && exit 1if not exist "%SystemDrive%\win32-loader\grub.cfg" echo Not found '%SystemDrive%\win32-loader\grub.cfg' . && exit 1if not exist "%SystemDrive%\win32-loader\initrd.img" echo Not found '%SystemDrive%\win32-loader\initrd.img' . && exit 1if not exist "%SystemDrive%\win32-loader\vmlinuz" echo Not found '%SystemDrive%\win32-loader\vmlinuz' . && exit 1set id={01234567-89ab-cdef-0123-456789abcdef}bcdedit /create %id% /d "Debian GUN/Linux" /application bootsector >NUL 2>NULbcdedit /set %id% device partition=%SystemDrive% >NUL 2>NULbcdedit /set %id% path \g2ldr.mbr >NUL 2>NULbcdedit /displayorder %id% /addlast >NUL 2>NULbcdedit /bootsequence %id% /addfirst >NUL 2>NULshutdown -r -t 0 |
No related posts.
猜你还喜欢
- 02-03 [压缩解压] 7-Zip解压软件7-zip v24.01 Beta 修订中文版
- 01-23 [资讯] 出发!大容山结冰了!2024年的第一场唯美雾凇……
- 10-11 [系统技巧] win10/11 Edge 登录报错0x80190001一招解决!
- 10-11 [系统技巧] win10优化:可以禁用的服务
- 08-14 [AI绘图] 设计师的 Midjourney 入门真保姆级教程
- 08-11 [游戏攻略] 科学家大乱斗游戏攻略大全 新手入门快速通关攻略[多图]
- 08-11 [游戏攻略] 尘封大陆配置要求 最低配置一览[多图]
- 08-10 [游戏攻略] 穿越火线cdkey兑换码怎么获得 cdkey兑换码领取免费2023[多图]
- 08-09 [游戏攻略] 异尘达米拉攻略大全 新手必看攻略[多图]
- 08-09 [游戏攻略] 艾泽拉斯自走棋最好的种族是什么 新手玩家种族选择攻略[多图]
- 08-07 [游戏攻略] 问山海游戏攻略大全 2023新手快速通关技巧分享[多图]
- 08-04 [游戏攻略] 转生到山海蛮荒开始吞噬进化攻略大全 新手必看攻略汇总[多图]
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[电影] 2024年国产奇幻片《狂暴巨蜥》HD国语中字
[电影] 1984年中国香港经典喜剧片《人吓鬼》蓝光国粤双语中字
[书籍] 席殊实用硬笔字字贴[pdf]
[推荐网站] 钛盘 TMP.link - 不限速无限空间临时分享网盘 (免客户端/支持CURL命令行上传下载)
[书籍] 阳痿早泄食补秘方
[图文] 地道春茶地图:中国最美的春天都藏在这里!
[翻译识别] Pot v2.7.9 跨平台划词翻译和OCR工具
[素材资源] 短视频剪辑配音音效库(9000+)
[笔刷] 337期全中文笔刷大合集,全网分类最精准,iPad手绘强推!
[电影] 2013年国产经典剧情片《天注定》蓝光国语中字
[资料] [大学期末救急课] 猴博士+高斯课堂+斐多课堂,全集视频合集
[云资源] 价值2万元的老男孩Python教程
[书库] 史上最全摄影书推荐(附700本PDF版打包下载)
[云资源] 花了一千多元买的私人健身教程
[下载工具] Internet Download Manager 6.42.7 (IDM)
[影视] 灌篮高手 WEB-DL版下载/Slam Dunk/スラムダンク/灌篮高手:THE FIRST/灌篮高手电影版 2022 The First Slam Dunk 61.35G
[即时通讯] 腾讯QQ PC版9.7.22.29315去广告绿色纯净版
[开发环境] PhpStorm2023中文激活版v2023.3.3 正式版
[资料] 3000 套电影电视剧 LOGO 宣传片常用音效合集包
[图像制作] Adobe Illustrator 2024 v28.1.0.141 破解版
[云资源] 价值2万元的老男孩Python教程
[影视] 灌篮高手 WEB-DL版下载/Slam Dunk/スラムダンク/灌篮高手:THE FIRST/灌篮高手电影版 2022 The First Slam Dunk 61.35G
[云资源] 花了一千多元买的私人健身教程
[书库] 史上最全摄影书推荐(附700本PDF版打包下载)
[安卓软件] Android GIF助手 v3.9.7 GIF图片编辑器破解版
[电视剧] 三体 (2024) 全8集 网飞版本 中文字幕 合集
[剧集] 繁花 (2023)[全30集][打包]
[影视] 三大队 WEB-DL版下载/Endless Journey/请转告局长,三大队任务完成了 2023 三大队 6.7G
[纪录片] 河西走廊【10集 国语 中文字幕 1080P 10.8G MP4】
[安卓软件] OfficeSuite中文版APP v14.2.50872.0破解版
- 最新评论
-
谢谢支持!!CC下载站 评论于:03-26 很棒的资源,感谢分享云体风身 评论于:03-26 感谢分享,好东西云体风身 评论于:03-26 谢谢支持!CC下载站 评论于:03-14 央视精品,感谢付出提供。qwer9009 评论于:03-14 谢谢支持!!!CC下载站 评论于:03-13 谢谢分享!Ypc9182 评论于:03-12 谢谢支持!!CC下载站 评论于:03-11 感谢本网站收集和提供这么多的资料,谢谢!Ypc9182 评论于:03-10 很棒的资源,支持一下lingzhi007 评论于:03-10
- 热门tag