无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 6754|回复: 12
打印 上一主题 下一主题

WINPE在U盘上启动的方法[只适用于XP/2003WINPE]

[复制链接]
跳转到指定楼层
1#
发表于 2007-1-19 13:19:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
个人比较喜欢深山红叶的启动盘,特别是WINPE部分。正好手边有个U盘,加上我的COMBO-DVD坏了。尝试着做个U盘启动的WINPE。看了很多关于让光盘在U盘上启动的,但是不是我所需要的。最后找到了一个微软的工具软件,特棒。是用来格式化用于WINPE启动的UFD(USB FLASH DISK),特别好用!语法如下:
formatufd x: /y 将x盘格式化为WINPE启动格式盘
formatufd x: /verify 检测x盘是否为WINPE可启动盘
格式化好U盘后,下来的工作就是把启动光盘上的东西拷贝到U盘上。深山红叶只支持C盘安装,所幸的是有个批处理文件就是做这个工作的。将下列代码拷贝成peinst.cmd,并执行。对了要看你要安装的WINPE光盘上WINPE主目录名称是多少,并将批处理文件里的i386都替换成相应的目录名就可以了。

下面我就深山红叶举个例子:
1、插入U盘,被系统识别成H盘;虚拟深山红叶ISO成光驱F:;拷贝代码保存为peinst.cmd
2、下载formatufd.exe拷贝到WINDOWS\SYSTEM32内
3、备份U盘上的内容,在COMMAND窗口下键入formatufd h: /y,将U盘格式化成WINPE启动盘。可用formatufd h: /verify 看一下是否成功。
4、在记事本或ULTRAEDIT里打开peinst.cmd,替换所有i386为PEXP,保存为peinstPEXP.cmd
5、在COMMAND窗口进入peinstPEXP.cmd所在目录,键入peinstPEXP.cmd -i F: H:
6、提示因为U盘速度不是很快,所以最好用ISO虚拟光驱,否则你要有足够耐心。
7、上诉步骤结束并也没有出错,恭喜你你的U盘可以启动了。
8、复制H:\minint\setupldr.bin到H:\ntldr,复制H:\minint\NTDETECT.COM到H:\
9、设好BIOS关于BOOT的选项。READY TO GO!!!


  1. @echo off
  2. title BartPE Installer script v2.0.2
  3. echo.
  4. echo BartPE Installer script v2.0.2
  5. echo Copyright (c) 2003-2006 Bart Lagerweij. All rights reserved.
  6. echo This program is free software. Use and/or distribute it under
  7. echo the terms of the Nu2 License (see peinst.txt file).
  8. echo.
  9. setlocal
  10. rem %~d0
  11. rem cd "%~dp0"
  12. set _base=%~dp0
  13. set _tmp=%tmp%\peinst.tmp
  14. set _tmp1=%tmp%\peinst1.tmp
  15. for %%i in (_source _target _go) do set %%i=
  16. :_arg
  17. for %%i in (-h -?) do if /I "%%i" == "%1" goto _usage
  18. if /I "%1" == "-i" goto _i
  19. if "%_source%" == "" if not "%1" == "" goto _1
  20. if "%_target%" == "" if not "%1" == "" goto _2
  21. goto _start
  22. :_i
  23. set _go=_install
  24. goto _next
  25. :_1
  26. set _source=%1
  27. goto _next
  28. :_2
  29. set _target=%1
  30. goto _next
  31. :_next
  32. shift
  33. if "%1" == "" goto _start
  34. goto _arg
  35. :_usage
  36. echo.
  37. echo Usage: %~n0 [Options] [SourcePath] [TargetPath]
  38. echo.
  39. echo SourcePath: the path where BartPE can be found. By default the drive where
  40. echo            %~n0 is located is used.
  41. echo TargetPath: is the path to where BartPE will be installed.By default drive
  42. echo            C: is used.
  43. echo Options:
  44. echo -i          Install BartPE files (choice 5,1)
  45. echo -h          Help
  46. goto _end
  47. :_start
  48. echo PEINST: Checking for required file(s)...
  49. for %%i in (%_base%mkbt.exe %_base%nt2peldr.exe) do if not exist %%i (
  50.         echo PEINST: Required file %%i not found!
  51.         goto _abort)
  52. rem if exist "%~d0\i386\setupldr.bin" set _source=%~d0
  53. rem if exist c:\boot.ini set _target=c:
  54. if not "%_go%" == "" goto %_go%
  55. :_main
  56. echo.
  57. echo     -[MAIN]-
  58. echo     1) Change source path [%_source%]
  59. echo        - Path to BartPE source files -
  60. echo     2) Change target path [%_target%]
  61. echo        - Path where BartPE will be installed -
  62. echo     3) List or format volume(s).
  63. echo        - use for formatting USB Flash Devices -
  64. echo     4) Create, delete partition(s).
  65. echo        - use for partitioning a harddisk -
  66. if "%_source%" == "" goto _menu1
  67. if "%_target%" == "" goto _menu1
  68. echo     5) Install BartPE to %_target%
  69. echo        - Install BartPE files -
  70. :_menu1
  71. echo     Q) Quit.
  72. echo.
  73. :_mainch
  74. set _ok=
  75. set /p _ok=Enter your choice :
  76. if "%_ok%" == "1" goto _getsrc
  77. if "%_ok%" == "2" goto _gettrg
  78. if "%_ok%" == "3" goto _voledit
  79. if "%_ok%" == "4" goto _part
  80. if "%_ok%" == "5" goto _instpe
  81. if /I "%_ok%" == "q" goto _end
  82. goto :_mainch

  83. :_getsrc
  84. set _ok=
  85. echo.
  86. echo PEINST: Please give the location to your BartPE files
  87. set /p _ok=Enter Source path :
  88. if exist "%_ok%\i386\setupldr.bin" (
  89.         set _source=%_ok%
  90. ) else (
  91.         echo.
  92.         echo PEINST: Error: The path "%_ok%" does not contain BartPE ^(or any other PE^) files!
  93.         pause
  94. )
  95. goto _main

  96. :_gettrg
  97. set _ok=
  98. echo.
  99. echo PEINST: Please give the location where to install to
  100. set /p _ok=Enter Target path :
  101. if not exist %_ok%\nul (
  102.         echo PEINST: Path "%_ok%" does not exist!
  103.         pause
  104.         goto _main
  105. )
  106. set _target=%_ok%
  107. goto _main

  108. :_instpe
  109. echo.
  110. echo     -[INSTALL]-
  111. echo     1) Install BartPE files to %_target%
  112. echo        - Install the files (takes a few minutes) -
  113. echo     2) Install PE-loader in %_target%\boot.ini
  114. echo        - use this if you want to select BartPE in your boot.ini menu -
  115. echo     Q) Quit
  116. echo.
  117. set _ok=
  118. set /p _ok=Enter your choice :
  119. if "%_ok%" == "1" goto _install
  120. if "%_ok%" == "2" goto _bootini
  121. if /I "%_ok%" == "q" goto _main
  122. goto :_voledit


  123. :_bootini
  124. echo PEINST: Checking if NT Loader is installed on drive %_target%
  125. if not exist %_target%\ntldr (
  126.         echo PEINST: Oops, file "%_target%\ntldr" not found.
  127.         goto _abort)

  128. echo PEINST: Checking if boot.ini is on drive %_target%
  129. if not exist %_target%\boot.ini (
  130.         echo PEINST: Oops, file "%_target%\ntldr" not found.
  131.         goto _abort)

  132. echo PEINST: Installing PE Bootsector (peboot.bin)
  133. %_base%mkbt.exe -x -c %_target% %_target%\peboot.bin
  134. if errorlevel 1 goto _abort
  135. echo PEINST: Updating peboot.bin
  136. %_base%nt2peldr.exe %_target%\peboot.bin
  137. if errorlevel 1 goto _abort
  138. echo PEINST: Updating boot.ini
  139. echo PEINST: Setting timeout to 30 seconds
  140. rem bootcfg.exe /Timeout 30
  141. rem if errorlevel 1 goto _abort
  142. echo PEINST: Adding BartPE entry to %_target%\boot.ini
  143. findstr /I /B /L /V "%_target%\peboot.bin" %_target%\boot.ini > %_target%\boot$.ini
  144. echo %_target%\peboot.bin="Boot BartPE (by PE Builder)" >> %_target%\boot$.ini
  145. attrib -r -h -s %_target%\boot.ini
  146. if errorlevel 1 goto _abort
  147. del /q /f %_target%\boot.ini
  148. if errorlevel 1 goto _abort
  149. ren %_target%\boot$.ini boot.ini
  150. if errorlevel 1 goto _abort
  151. attrib +r +h +s %_target%\boot.ini
  152. echo PEINST: Installing PE Loader (peldr)
  153. copy %_source%\i386\setupldr.bin %_target%\peldr
  154. if errorlevel 1 goto _abort
  155. echo PEINST: PE-Loader installed...
  156. pause
  157. goto _main

  158. :_part
  159. echo.
  160. call :_dskcmd "" "list disk"
  161. if errorlevel 1 (
  162.         echo PEINST: Getting disk list failed. No disks?!?
  163.         pause
  164.         goto _main
  165. )
  166. :_partseldsk
  167. echo.
  168. set _disk=
  169. set /p _disk=Select disk. Enter disk number or 'q' to go back :
  170. if /I "%_disk%" == "q" goto _main
  171. call :_chkdsk %_disk%
  172. if errorlevel 1 goto _part
  173. goto _partedit

  174. :_voledit
  175. echo.
  176. echo     -[VOLUME]-
  177. echo     1) List all volumes
  178. echo     2) Format a volume (FAT or NTFS)
  179. echo     Q) Quit
  180. echo.
  181. set _ok=
  182. set /p _ok=Enter your choice :
  183. if "%_ok%" == "1" call :_dskcmd "" "list volume"
  184. if "%_ok%" == "2" goto _volfmt
  185. if /I "%_ok%" == "q" goto _main
  186. goto :_voledit

  187. :_volfmt
  188. set _letter=
  189. set /p _letter=Enter the drive letter to format (leave empty to quit) :
  190. if "%_letter%" == "" goto _voledit
  191. set _letter=%_letter:~0,1%
  192. :_askfs
  193. set _ok=
  194. set /p _ok=Filesystem to use, NTFS or FAT? (n/f/q to quit) :
  195. if /I "%_ok%" == "q" goto _voledit
  196. if /I "%_ok%" == "n" goto _askfs2
  197. if /I "%_ok%" == "f" goto _askfs2
  198. goto _askfs
  199. :_askfs2
  200. if /I "%_ok%" == "n" set _fs=ntfs
  201. if /I "%_ok%" == "f" set _fs=fat
  202. echo.
  203. echo PEINST: Are you sure you want to format drive "%_letter%:" ?
  204. echo PEINST: -- THIS WILL TOTALLY ERASE ALL DATA ON THAT VOLUME! --
  205. echo.
  206. set _ok=
  207. set /p _ok=To continue type "YES" (uppercase without quotes) :
  208. if "%_ok%" == "YES" goto _volfmtok
  209. echo PEINST: You typed "%_OK%", that is not equal to "YES", bailing out...
  210. goto _voledit
  211. :_volfmtok
  212. call :_format %_letter% %_fs%
  213. if errorlevel 1 (
  214.         echo PEINST: Error: Format returned an error...
  215.         pause
  216.         goto _voledit
  217. )
  218. echo.
  219. echo PEINST: Format was succesfull
  220. pause
  221. goto _voledit

  222. :_format
  223. if "%1" == "" (
  224.         echo PEINST: Error: _format: %1 empty
  225.         goto _abort)
  226. if "%2" == "" (
  227.         echo PEINST: Error: _format: %2 empty
  228.         goto _abort)
  229. echo PEINST: Formating %1:
  230. format %1: /fs:%2 /v:BartPE /backup /force
  231. goto :eof

  232. :_partedit
  233. echo.
  234. echo Currently selected disk: %_disk%
  235. echo.
  236. echo     -[PARTITION]-
  237. echo     1) Show disk details
  238. echo     2) List partitions
  239. echo     3) Create primary partition and format it
  240. echo     4) Remove a partition
  241. echo     5) Remove all partitions (clean)
  242. echo     Q) Quit
  243. echo.
  244. set _ok=
  245. set /p _ok=Enter your choice :
  246. if "%_ok%" == "1" call :_dskcmd %_disk% "detail disk"
  247. if "%_ok%" == "2" call :_dskcmd %_disk% "list partition"
  248. if "%_ok%" == "3" goto _crpart
  249. if "%_ok%" == "4" goto _delpart
  250. if "%_ok%" == "5" goto _clean
  251. if /I "%_ok%" == "q" goto _main
  252. goto :_partedit

  253. :_crpart
  254. echo.
  255. set _size=
  256. set /p _size=New partition size in MB (hit enter for all available space, q to quit) :
  257. if /I "%_size%" == "q" goto _partedit
  258. :_crpartl
  259. set _letter=
  260. set /p _letter=The drive letter you want to assign to the volume (q to quit) :
  261. if /I "%_letter%" == "q" goto _partedit
  262. set _letter=%_letter:~0,1%
  263. :_crparta
  264. set _active=
  265. echo PEINST: If you want to boot from this partition you must set it "active"
  266. set /p _active=Set the partition active? (y/n/q to quit) :
  267. if /I "%_active%" == "q" goto _partedit
  268. if /I "%_active%" == "y" goto _crpartgo
  269. if /I "%_active%" == "n" goto _crpartgo
  270. goto _crparta
  271. :_crpartgo
  272. set _sbuf="create partition primary
  273. if not "%_size%" == "" set _sbuf=%_sbuf% size=%_size%
  274. set _sbuf=%_sbuf%"
  275. if /I "%_active%" == "y" set _sbuf=%_sbuf% "active"
  276. set _sbuf=%_sbuf% "assign letter=%_letter%"
  277. call :_dskcmd %_disk% %_sbuf%
  278. if errorlevel 1 (
  279.         echo PEINST: Error: Partition creation returned an error...
  280.         pause
  281.         goto _partedit)
  282. call :_format %_letter% ntfs
  283. if errorlevel 1 (
  284.         echo PEINST: Error: Format returned an error...
  285.         pause
  286.         goto _partedit)
  287. echo.
  288. echo PEINST: Partition created and formatted OK
  289. echo PEINST: Drive letter to access the new volume is  "%_letter%:"
  290. goto _partedit

  291. :_clean
  292. echo.
  293. echo PEINST: Do you want to remove all partitions from disk %_disk%?
  294. echo PEINST: -- THIS WILL TOTALLY ERASE ALL DATA ON YOUR DISK! --
  295. echo.
  296. set _ok=
  297. set /p _ok=To continue type "YES" (uppercase without quotes) :
  298. if "%_ok%" == "YES" goto _cleanok
  299. echo PEINST: You typed "%_OK%", that is not equal to "YES", bailing out...
  300. goto _partedit
  301. :_cleanok
  302. call :_dskcmd %_disk% "clean"
  303. if errorlevel 1 pause
  304. goto _partedit

  305. :_dskcmd
  306. echo rem > %_tmp%
  307. if not "%~1" == "" (
  308.         echo Disk="%~1"
  309.         echo select disk %~1 >> %_tmp%)
  310. :_dskcmdl
  311. if "%~2" == "" goto _dskcmdgo
  312. echo Command="%~2"
  313. echo %~2 >> %_tmp%
  314. shift
  315. goto _dskcmdl
  316. :_dskcmdgo
  317. diskpart.exe /s "%_tmp%" > %_tmp1%
  318. call :_print "%_tmp1%"
  319. if errorlevel 1 goto _dskcmderr
  320. goto :eof
  321. :_dskcmderr
  322. color 00
  323. goto :eof

  324. :_chkdsk
  325. if "%1" == "" goto _chkdski
  326. echo.
  327. echo PEINST: Checking disk %1, please wait...
  328. echo select disk %1 > %_tmp%
  329. echo detail disk >> %_tmp%
  330. diskpart.exe /s "%_tmp%" > %_tmp1%
  331. rem call :_print "%_tmp1%"
  332. if errorlevel 1 goto _chkdski
  333. echo PEINST: Disk number %1 is a valid disk number...
  334. goto :eof
  335. :_chkdski
  336. echo PEINST: Disk number %1 is invalid!
  337. :_chkdsk1n
  338. color 00
  339. goto :eof

  340. :_install
  341. if not exist "%_source%\i386\setupldr.bin" (
  342.         echo.
  343.         echo PEINST: Error: The path "%_source%" does not contain BartPE ^(or any other PE^) files!
  344.         pause
  345.         goto _main
  346. )
  347. rem if /I "%_target%" == "%SystemDrive%" (
  348. rem         echo PEINST: Error: You cannot install BartPE onto your current SystemDrive
  349. rem         pause
  350. rem         goto _main
  351. rem )
  352. if not exist "%_target%" (
  353.         echo PEINST: Target path "%_target%" does not exist!
  354.         pause
  355.         goto _main
  356. )
  357. if not exist %_target%\ntdetect.com (
  358.         echo PEINST: Installing ntdetect to %_target%
  359.         copy %_source%\i386\ntdetect.com %_target%\
  360.         if errorlevel 1 goto _abort
  361. )
  362. if not exist %_target%\ntldr (
  363.         echo PEINST: Installing ntldr to %_target%
  364.         copy %_source%\i386\setupldr.bin %_target%\ntldr
  365.         if errorlevel 1 goto _abort
  366. )

  367. echo PEINST: Installing BartPE files from %_source% to %_target%\

  368. call :_copy i386 minint
  369. if errorlevel 1 goto _abort
  370. call :_copy programs programs
  371. if errorlevel 1 goto _abort

  372. echo.
  373. echo PEINST: Installation completed...
  374. if not "%_go%" == "" goto _end
  375. pause
  376. goto _main
  377. :_copy
  378. if "%~1" == "" goto :eof
  379. if "%~2" == "" goto :eof
  380. if not exist "%_source%\%~1" goto :eof
  381. if exist "%_target%\%~2" (
  382.         echo PEINST: Checking for BartPE tag file ^(save removal^)...
  383.         if not exist "%_target%\%~2\bartpe.tag" goto _tagerr
  384.         echo PEINST: Removing %_target%\%~2
  385.         rmdir /s /q "%_target%\%~2")
  386.         if errorlevel 1 goto :eof
  387.         mkdir "%_target%\%~2"
  388.         if errorlevel 1 goto :eof
  389.         echo PEINST: Tag file for BartPE do not remove! > "%_target%\%~2\bartpe.tag"
  390.         if errorlevel 1 goto :eof
  391. echo PEINST: Copying files from "%_source%\%~1" to "%_target%\%~2"
  392. xcopy /e /s "%_source%\%~1\*.*" "%_target%\%~2"
  393. goto :eof
  394. :_tagerr
  395. echo PEINST: Tag file "%_target%\%~2\bartpe.tag" not found!
  396. echo PEINST: Not safe to remove directory!
  397. echo.
  398. echo PEINST: Workaround:
  399. echo PEINST: You could delete the folder "%_target%\%~2" manually and restart the installation...
  400. rem set errorlevel to 1 by (mis)using color
  401. color 00
  402. goto :eof
  403. :_print
  404. for /f "skip=4 tokens=*" %%i in (%~1) do echo %%i
  405. goto :eof
  406. :_abort
  407. echo.
  408. echo PEINST: Aborted...
  409. pause
  410. goto _main
  411. :_end
  412. for %%i in (_tmp _tmp1) do if exist "%%i" del /f /q "%%i"
  413. endlocal
  414. echo.
  415. echo PEINST: Done (PEINST.CMD will be closed)
  416. pause
复制代码

[ 本帖最后由 damcool 于 2007-1-19 02:15 PM 编辑 ]

formatufd.zip

52 KB, 下载次数: 233, 下载积分: 无忧币 -2

formatufd.exe

2#
发表于 2007-1-19 13:34:35 | 只看该作者
谢谢楼主。收藏了。
回复

使用道具 举报

3#
发表于 2007-1-19 17:24:34 | 只看该作者
谢谢楼主。收藏了。
回复

使用道具 举报

4#
发表于 2007-1-19 17:55:02 | 只看该作者
谢谢 不错的东东
回复

使用道具 举报

5#
发表于 2007-1-19 19:30:40 | 只看该作者
学习一下,还是比较有用的...
回复

使用道具 举报

6#
发表于 2007-1-19 19:38:16 | 只看该作者
谢谢楼主,学习一下
回复

使用道具 举报

7#
发表于 2007-1-19 23:57:44 | 只看该作者
好东西,载下来试试,谢
回复

使用道具 举报

8#
发表于 2007-1-20 00:52:10 | 只看该作者
正找它呢?就来啦。及时雨。
回复

使用道具 举报

9#
发表于 2007-1-20 09:40:35 | 只看该作者

U盘的问题

我的U盘是金士顿的DataTraveler 1G,我在用Formatufd时提示出错,我不清楚这是否与U盘有关,是容量问题还是U盘类型问题?请知道原因的人赐教。另我用另一牌子的U盘512M的就没有问题。
回复

使用道具 举报

10#
发表于 2007-1-20 22:10:25 | 只看该作者
我的U盘不行
回复

使用道具 举报

11#
发表于 2007-1-20 22:18:19 | 只看该作者
强啊,学做一个!!!
回复

使用道具 举报

12#
发表于 2007-1-21 00:08:11 | 只看该作者
试一下看看。不过试之前有一个问题想请教一下。如果不用深山红叶的,从第4步开始,又应该怎么做?
回复

使用道具 举报

13#
发表于 2007-1-21 13:37:54 | 只看该作者
下载收藏!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-11-30 12:30

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表