无忧启动论坛
标题:
WINPE在U盘上启动的方法[只适用于XP/2003WINPE]
[打印本页]
作者:
damcool
时间:
2007-1-19 13:19
标题:
WINPE在U盘上启动的方法[只适用于XP/2003WINPE]
个人比较喜欢深山红叶的启动盘,特别是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!!!
@echo off
title BartPE Installer script v2.0.2
echo.
echo BartPE Installer script v2.0.2
echo Copyright (c) 2003-2006 Bart Lagerweij. All rights reserved.
echo This program is free software. Use and/or distribute it under
echo the terms of the Nu2 License (see peinst.txt file).
echo.
setlocal
rem %~d0
rem cd "%~dp0"
set _base=%~dp0
set _tmp=%tmp%\peinst.tmp
set _tmp1=%tmp%\peinst1.tmp
for %%i in (_source _target _go) do set %%i=
:_arg
for %%i in (-h -?) do if /I "%%i" == "%1" goto _usage
if /I "%1" == "-i" goto _i
if "%_source%" == "" if not "%1" == "" goto _1
if "%_target%" == "" if not "%1" == "" goto _2
goto _start
:_i
set _go=_install
goto _next
:_1
set _source=%1
goto _next
:_2
set _target=%1
goto _next
:_next
shift
if "%1" == "" goto _start
goto _arg
:_usage
echo.
echo Usage: %~n0 [Options] [SourcePath] [TargetPath]
echo.
echo SourcePath: the path where BartPE can be found. By default the drive where
echo %~n0 is located is used.
echo TargetPath: is the path to where BartPE will be installed.By default drive
echo C: is used.
echo Options:
echo -i Install BartPE files (choice 5,1)
echo -h Help
goto _end
:_start
echo PEINST: Checking for required file(s)...
for %%i in (%_base%mkbt.exe %_base%nt2peldr.exe) do if not exist %%i (
echo PEINST: Required file %%i not found!
goto _abort)
rem if exist "%~d0\i386\setupldr.bin" set _source=%~d0
rem if exist c:\boot.ini set _target=c:
if not "%_go%" == "" goto %_go%
:_main
echo.
echo -[MAIN]-
echo 1) Change source path [%_source%]
echo - Path to BartPE source files -
echo 2) Change target path [%_target%]
echo - Path where BartPE will be installed -
echo 3) List or format volume(s).
echo - use for formatting USB Flash Devices -
echo 4) Create, delete partition(s).
echo - use for partitioning a harddisk -
if "%_source%" == "" goto _menu1
if "%_target%" == "" goto _menu1
echo 5) Install BartPE to %_target%
echo - Install BartPE files -
:_menu1
echo Q) Quit.
echo.
:_mainch
set _ok=
set /p _ok=Enter your choice :
if "%_ok%" == "1" goto _getsrc
if "%_ok%" == "2" goto _gettrg
if "%_ok%" == "3" goto _voledit
if "%_ok%" == "4" goto _part
if "%_ok%" == "5" goto _instpe
if /I "%_ok%" == "q" goto _end
goto :_mainch
:_getsrc
set _ok=
echo.
echo PEINST: Please give the location to your BartPE files
set /p _ok=Enter Source path :
if exist "%_ok%\i386\setupldr.bin" (
set _source=%_ok%
) else (
echo.
echo PEINST: Error: The path "%_ok%" does not contain BartPE ^(or any other PE^) files!
pause
)
goto _main
:_gettrg
set _ok=
echo.
echo PEINST: Please give the location where to install to
set /p _ok=Enter Target path :
if not exist %_ok%\nul (
echo PEINST: Path "%_ok%" does not exist!
pause
goto _main
)
set _target=%_ok%
goto _main
:_instpe
echo.
echo -[INSTALL]-
echo 1) Install BartPE files to %_target%
echo - Install the files (takes a few minutes) -
echo 2) Install PE-loader in %_target%\boot.ini
echo - use this if you want to select BartPE in your boot.ini menu -
echo Q) Quit
echo.
set _ok=
set /p _ok=Enter your choice :
if "%_ok%" == "1" goto _install
if "%_ok%" == "2" goto _bootini
if /I "%_ok%" == "q" goto _main
goto :_voledit
:_bootini
echo PEINST: Checking if NT Loader is installed on drive %_target%
if not exist %_target%\ntldr (
echo PEINST: Oops, file "%_target%\ntldr" not found.
goto _abort)
echo PEINST: Checking if boot.ini is on drive %_target%
if not exist %_target%\boot.ini (
echo PEINST: Oops, file "%_target%\ntldr" not found.
goto _abort)
echo PEINST: Installing PE Bootsector (peboot.bin)
%_base%mkbt.exe -x -c %_target% %_target%\peboot.bin
if errorlevel 1 goto _abort
echo PEINST: Updating peboot.bin
%_base%nt2peldr.exe %_target%\peboot.bin
if errorlevel 1 goto _abort
echo PEINST: Updating boot.ini
echo PEINST: Setting timeout to 30 seconds
rem bootcfg.exe /Timeout 30
rem if errorlevel 1 goto _abort
echo PEINST: Adding BartPE entry to %_target%\boot.ini
findstr /I /B /L /V "%_target%\peboot.bin" %_target%\boot.ini > %_target%\boot$.ini
echo %_target%\peboot.bin="Boot BartPE (by PE Builder)" >> %_target%\boot$.ini
attrib -r -h -s %_target%\boot.ini
if errorlevel 1 goto _abort
del /q /f %_target%\boot.ini
if errorlevel 1 goto _abort
ren %_target%\boot$.ini boot.ini
if errorlevel 1 goto _abort
attrib +r +h +s %_target%\boot.ini
echo PEINST: Installing PE Loader (peldr)
copy %_source%\i386\setupldr.bin %_target%\peldr
if errorlevel 1 goto _abort
echo PEINST: PE-Loader installed...
pause
goto _main
:_part
echo.
call :_dskcmd "" "list disk"
if errorlevel 1 (
echo PEINST: Getting disk list failed. No disks?!?
pause
goto _main
)
:_partseldsk
echo.
set _disk=
set /p _disk=Select disk. Enter disk number or 'q' to go back :
if /I "%_disk%" == "q" goto _main
call :_chkdsk %_disk%
if errorlevel 1 goto _part
goto _partedit
:_voledit
echo.
echo -[VOLUME]-
echo 1) List all volumes
echo 2) Format a volume (FAT or NTFS)
echo Q) Quit
echo.
set _ok=
set /p _ok=Enter your choice :
if "%_ok%" == "1" call :_dskcmd "" "list volume"
if "%_ok%" == "2" goto _volfmt
if /I "%_ok%" == "q" goto _main
goto :_voledit
:_volfmt
set _letter=
set /p _letter=Enter the drive letter to format (leave empty to quit) :
if "%_letter%" == "" goto _voledit
set _letter=%_letter:~0,1%
:_askfs
set _ok=
set /p _ok=Filesystem to use, NTFS or FAT? (n/f/q to quit) :
if /I "%_ok%" == "q" goto _voledit
if /I "%_ok%" == "n" goto _askfs2
if /I "%_ok%" == "f" goto _askfs2
goto _askfs
:_askfs2
if /I "%_ok%" == "n" set _fs=ntfs
if /I "%_ok%" == "f" set _fs=fat
echo.
echo PEINST: Are you sure you want to format drive "%_letter%:" ?
echo PEINST: -- THIS WILL TOTALLY ERASE ALL DATA ON THAT VOLUME! --
echo.
set _ok=
set /p _ok=To continue type "YES" (uppercase without quotes) :
if "%_ok%" == "YES" goto _volfmtok
echo PEINST: You typed "%_OK%", that is not equal to "YES", bailing out...
goto _voledit
:_volfmtok
call :_format %_letter% %_fs%
if errorlevel 1 (
echo PEINST: Error: Format returned an error...
pause
goto _voledit
)
echo.
echo PEINST: Format was succesfull
pause
goto _voledit
:_format
if "%1" == "" (
echo PEINST: Error: _format: %1 empty
goto _abort)
if "%2" == "" (
echo PEINST: Error: _format: %2 empty
goto _abort)
echo PEINST: Formating %1:
format %1: /fs:%2 /v:BartPE /backup /force
goto :eof
:_partedit
echo.
echo Currently selected disk: %_disk%
echo.
echo -[PARTITION]-
echo 1) Show disk details
echo 2) List partitions
echo 3) Create primary partition and format it
echo 4) Remove a partition
echo 5) Remove all partitions (clean)
echo Q) Quit
echo.
set _ok=
set /p _ok=Enter your choice :
if "%_ok%" == "1" call :_dskcmd %_disk% "detail disk"
if "%_ok%" == "2" call :_dskcmd %_disk% "list partition"
if "%_ok%" == "3" goto _crpart
if "%_ok%" == "4" goto _delpart
if "%_ok%" == "5" goto _clean
if /I "%_ok%" == "q" goto _main
goto :_partedit
:_crpart
echo.
set _size=
set /p _size=New partition size in MB (hit enter for all available space, q to quit) :
if /I "%_size%" == "q" goto _partedit
:_crpartl
set _letter=
set /p _letter=The drive letter you want to assign to the volume (q to quit) :
if /I "%_letter%" == "q" goto _partedit
set _letter=%_letter:~0,1%
:_crparta
set _active=
echo PEINST: If you want to boot from this partition you must set it "active"
set /p _active=Set the partition active? (y/n/q to quit) :
if /I "%_active%" == "q" goto _partedit
if /I "%_active%" == "y" goto _crpartgo
if /I "%_active%" == "n" goto _crpartgo
goto _crparta
:_crpartgo
set _sbuf="create partition primary
if not "%_size%" == "" set _sbuf=%_sbuf% size=%_size%
set _sbuf=%_sbuf%"
if /I "%_active%" == "y" set _sbuf=%_sbuf% "active"
set _sbuf=%_sbuf% "assign letter=%_letter%"
call :_dskcmd %_disk% %_sbuf%
if errorlevel 1 (
echo PEINST: Error: Partition creation returned an error...
pause
goto _partedit)
call :_format %_letter% ntfs
if errorlevel 1 (
echo PEINST: Error: Format returned an error...
pause
goto _partedit)
echo.
echo PEINST: Partition created and formatted OK
echo PEINST: Drive letter to access the new volume is "%_letter%:"
goto _partedit
:_clean
echo.
echo PEINST: Do you want to remove all partitions from disk %_disk%?
echo PEINST: -- THIS WILL TOTALLY ERASE ALL DATA ON YOUR DISK! --
echo.
set _ok=
set /p _ok=To continue type "YES" (uppercase without quotes) :
if "%_ok%" == "YES" goto _cleanok
echo PEINST: You typed "%_OK%", that is not equal to "YES", bailing out...
goto _partedit
:_cleanok
call :_dskcmd %_disk% "clean"
if errorlevel 1 pause
goto _partedit
:_dskcmd
echo rem > %_tmp%
if not "%~1" == "" (
echo Disk="%~1"
echo select disk %~1 >> %_tmp%)
:_dskcmdl
if "%~2" == "" goto _dskcmdgo
echo Command="%~2"
echo %~2 >> %_tmp%
shift
goto _dskcmdl
:_dskcmdgo
diskpart.exe /s "%_tmp%" > %_tmp1%
call :_print "%_tmp1%"
if errorlevel 1 goto _dskcmderr
goto :eof
:_dskcmderr
color 00
goto :eof
:_chkdsk
if "%1" == "" goto _chkdski
echo.
echo PEINST: Checking disk %1, please wait...
echo select disk %1 > %_tmp%
echo detail disk >> %_tmp%
diskpart.exe /s "%_tmp%" > %_tmp1%
rem call :_print "%_tmp1%"
if errorlevel 1 goto _chkdski
echo PEINST: Disk number %1 is a valid disk number...
goto :eof
:_chkdski
echo PEINST: Disk number %1 is invalid!
:_chkdsk1n
color 00
goto :eof
:_install
if not exist "%_source%\i386\setupldr.bin" (
echo.
echo PEINST: Error: The path "%_source%" does not contain BartPE ^(or any other PE^) files!
pause
goto _main
)
rem if /I "%_target%" == "%SystemDrive%" (
rem echo PEINST: Error: You cannot install BartPE onto your current SystemDrive
rem pause
rem goto _main
rem )
if not exist "%_target%" (
echo PEINST: Target path "%_target%" does not exist!
pause
goto _main
)
if not exist %_target%\ntdetect.com (
echo PEINST: Installing ntdetect to %_target%
copy %_source%\i386\ntdetect.com %_target%\
if errorlevel 1 goto _abort
)
if not exist %_target%\ntldr (
echo PEINST: Installing ntldr to %_target%
copy %_source%\i386\setupldr.bin %_target%\ntldr
if errorlevel 1 goto _abort
)
echo PEINST: Installing BartPE files from %_source% to %_target%\
call :_copy i386 minint
if errorlevel 1 goto _abort
call :_copy programs programs
if errorlevel 1 goto _abort
echo.
echo PEINST: Installation completed...
if not "%_go%" == "" goto _end
pause
goto _main
:_copy
if "%~1" == "" goto :eof
if "%~2" == "" goto :eof
if not exist "%_source%\%~1" goto :eof
if exist "%_target%\%~2" (
echo PEINST: Checking for BartPE tag file ^(save removal^)...
if not exist "%_target%\%~2\bartpe.tag" goto _tagerr
echo PEINST: Removing %_target%\%~2
rmdir /s /q "%_target%\%~2")
if errorlevel 1 goto :eof
mkdir "%_target%\%~2"
if errorlevel 1 goto :eof
echo PEINST: Tag file for BartPE do not remove! > "%_target%\%~2\bartpe.tag"
if errorlevel 1 goto :eof
echo PEINST: Copying files from "%_source%\%~1" to "%_target%\%~2"
xcopy /e /s "%_source%\%~1\*.*" "%_target%\%~2"
goto :eof
:_tagerr
echo PEINST: Tag file "%_target%\%~2\bartpe.tag" not found!
echo PEINST: Not safe to remove directory!
echo.
echo PEINST: Workaround:
echo PEINST: You could delete the folder "%_target%\%~2" manually and restart the installation...
rem set errorlevel to 1 by (mis)using color
color 00
goto :eof
:_print
for /f "skip=4 tokens=*" %%i in (%~1) do echo %%i
goto :eof
:_abort
echo.
echo PEINST: Aborted...
pause
goto _main
:_end
for %%i in (_tmp _tmp1) do if exist "%%i" del /f /q "%%i"
endlocal
echo.
echo PEINST: Done (PEINST.CMD will be closed)
pause
复制代码
[
本帖最后由 damcool 于 2007-1-19 02:15 PM 编辑
]
formatufd.zip
2007-1-19 13:19 上传
点击文件名下载附件
下载积分: 无忧币 -2
52 KB, 下载次数: 233, 下载积分: 无忧币 -2
formatufd.exe
作者:
zhao2008
时间:
2007-1-19 13:34
谢谢楼主。收藏了。
作者:
LTH
时间:
2007-1-19 17:24
谢谢楼主。收藏了。
作者:
欠你滴泪
时间:
2007-1-19 17:55
谢谢 不错的东东
作者:
free115210
时间:
2007-1-19 19:30
学习一下,还是比较有用的...
作者:
qhlh
时间:
2007-1-19 19:38
谢谢楼主,学习一下
作者:
lbnmg
时间:
2007-1-19 23:57
好东西,载下来试试,谢
作者:
twticpgk
时间:
2007-1-20 00:52
正找它呢?就来啦。及时雨。
作者:
Roger_lm
时间:
2007-1-20 09:40
标题:
U盘的问题
我的U盘是金士顿的DataTraveler 1G,我在用Formatufd时提示出错,我不清楚这是否与U盘有关,是容量问题还是U盘类型问题?请知道原因的人赐教。另我用另一牌子的U盘512M的就没有问题。
作者:
lmj197549
时间:
2007-1-20 22:10
我的U盘不行
作者:
钱品
时间:
2007-1-20 22:18
强啊,学做一个!!!
作者:
triquan
时间:
2007-1-21 00:08
试一下看看。不过试之前有一个问题想请教一下。如果不用深山红叶的,从第4步开始,又应该怎么做?
作者:
大秦武士
时间:
2007-1-21 13:37
下载收藏!
欢迎光临 无忧启动论坛 (http://wuyou.net./)
Powered by Discuz! X3.3