It is a pre shell,essentially a command interpreter.
Load it first then it can call call winpeshl, create shortcuts,register components,install drivers,etc.
It also provides explorer support and hooks into the start controls to provide shudown/reboot functions.
Typically you replace winpe system hive cmdline entry E.G when building pe if you have loaded winpe system hive as PE_SYS
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\PE_SYS\Setup]
"CmdLine"="PECMD.EXE MAIN %Windir%\\system32\\PECMD.INI"
Then pecmd will start up first and carry out the instructions you have put in your winpe %windir%\system32\pecmd.ini.
Typical example pecmd.ini: ( Have bolded commands so easier to see - can't use codebox for that )
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB OSD
// set resolution
DISP W1024 H768 B32 F60
//pull up a wallpaper during setup phase
LOGO %Windir%\Web\Wallpaper\Windows\img0.jpg
//display a message on desktop
TEXT SIW2 PE3.1x64 WELCOME... L30 T330 R740 B400 $24*
// call winpeshl.exe note: winpeshl.ini should contain the line wpeinit
EXEC winpeshl.exe
// call ux64.exe (for win7 theme support,ux.exe not needed for win8/10 )
EXEC Ux64.EXE
// Tells pecmd to init on taskbar and load usb drives
INIT I,U 4000
// shows all drives including hidden and assigns letters automatically
SHOW -1:-1
// create shortcuts
LINK %Desktop%\Backupper,x:\Program Files\Aomei\Backupper.exe
LINK %StartMenu%\Install\WinNtSetup,x:\Program Files\WinNTSetup_x64.exe
LINK %Startmenu%\Install\Setup,x:\setup.exe
// PINT ,Startmenu or ,Taskband for pin to
PINT %SystemRoot%\explorer.exe,Startmenu
PINT %SystemRoot%\regedit.exe,Startmenu
PINT %SystemRoot%\system32\notepad.exe,Taskband
PINT x:\Program Files\QTWeb\QTWeb.exe,Taskband
PINT x:\Program Files\PENetwork\PENetwork.exe,Taskband
_END
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB LoadShell
// start network NDISWAN. EXEC =command means wait till it has finished. EXEC !command means execute silenltly.
EXEC @!=netcfg.exe -e -c p -i MS_NDISWAN
// Shell execute use CALLwith leading $ (similar to regsvr32)
CALL $%WinDir%\SysWOW64\Macromed\Flash\*.dll
_END
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB FINSET
// new text on desktop
TEXT SIW2 Loading Desktop... L430 T30 R740 B400 $24*
WAIT 300
// TEAM COMMAND1|COMMAND2|COMMAND3
TEAM SHEL %SystemRoot%\explorer.exe|WAIT 500|LOGO
WAIT 300
//Delete a reg entry
REGI $HKLM\SOFTWARE\PELOGON\hotkey1!
// Call regedit to merge a reg file
EXEC =REGEDIT /S %CurDir%\PECUSTOM.REG
//Delete the annoying ini files on desktop
FILE %public%\desktop\desktop.ini
FILE X:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk
FILE X:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories
FILE X:\Users\Default\Desktop\desktop.ini
//start a service
SERV MpsSvc
WAIT 300
//install driver
DEVI %WinDir%\inf\hdaudio.inf
DEVI %WinDir%\inf\net*.inf
WAIT 2000
//Bubble Tip
TIPS FOR WIRELESS,RUN PENETWORK,,1,,#1
//wait so tips keep showing for 5 secs
WAIT 5000
//Remove message from desktop
TEXT
_END
////////////////////////////////////////////////////////////////////////////////////////////////
CALL OSD
CALL LoadShell
CALL FINSET
changelog:
09.10: Win10PE: PINT processing
08.26: Win10PE: Win-D Display Desktop SENDMSG? Timeout
08.10: Captures a TABL scroll bar message
Pre30: Supports SATA hard disk number
Pre29: TIPS supports variable comma
Pre26: REGI supports all types
Pre22: SIZE/CMPS, etc. Supports quotation marks HELP supports automatic line feed switching
Pre21: PUTF supports %2
Pre20: READ/PUTF support variable incoming file name (without quotation marks)
Pre19: REGI supports REG_LINK
Pre18: READ support quotation marks
Pre17: GETF/PUTF/MDIR support quotation marks FNAM/FIND -pid/-wid illegal id also initializes variables
Pre16: REGI support byte stream, support only create key
Pre15: REGI Smart Processing!
Pre14: RICHEDIT supports super capture
Pre13: RICHEDIT automatically supports ENCHANGE, supports NUM
Pre12: WRIT write variable
Pre11: LPOS RPOS SED supports line number and reverse
Pre10: MOUN-UDM mapsub supports hard disk files
Pre6: MESS Negative timeout does not show the progress of time
Pre5: SEND @@ can be sent by window type name SHEL restart interface SCRN-cap file file memory reduction SERV support service settings
[attach=1]
[attach=2]
PECMD mount VHD right-click menu
pecmd.ini
_SUB RegVHDPecmd
ENVI ?&&WinVer=WinVer
IFEX #%&WinVer%>=0x600000000,
{
ENVI^ EnviMode=1
REGI HKCR\Virtual.Machine.HD.PECMD\Shell\\=
REGI $HKCR\Virtual.Machine.HD.PECMD\Shell\1Mount\\=MOUNT VHD(&M)
REGI $HKCR\Virtual.Machine.HD.PECMD\Shell\1Mount\command\\=PECMD MOUN-vhd "%%L"
REGI $HKCR\Virtual.Machine.HD.PECMD\Shell\2RMount\\=Read Only Mount VHD(&R)
REGI $HKCR\Virtual.Machine.HD.PECMD\Shell\2RMount\command\\=PECMD MOUN-vhd -r "%%L"
REGI $HKCR\Virtual.Machine.HD.PECMD\Shell\3Dismount\\=Unmount VHD(&D)
REGI $HKCR\Virtual.Machine.HD.PECMD\Shell\3Dismount\command\\=PECMD MOUN-vhd -u "%%L"
REGI $HKCR\.vhd\\=Virtual.Machine.HD.PECMD
}
_END
There is a lot I don't understand.
I think it does use imdisk.
EXEC =!%WinDir%\System32\cmd.exe /V:ON /C "set IsoName=\_ISO\WinPE\Win10XPE_%PROCESSOR_ARCHITECTURE:AMD=x%.ISO &for %a in (C D E F G H I J K L M N O P Q R S T U V W Y Z) do if exist %a:!IsoName! imdisk.exe -a -f %a:!IsoName! -m Y: "
You could probably use FORX for some of that
ENVI ISOARCH=x86
FIND $%PROCESSOR_ARCHITECTURE%=AMD64,ENVI ISOARCH=x64
then use
FORX \_ISO\WINPE\win10xpe_%ISOARCH%.iso
demo.ini
_SUB RecordFile
ENVI ListFile=%ListFile%|%somefile%
IFEX $%FileNum%=0,ENVI lf=%somefile%|CALC FileNum=%FileNum%+1!ENVI lf=%lf%|%somefile%
_END
_SUB Windows1,W400H200,Inventory
EDIT Edit1,L0T0W370H20,%ListFile%
LIST List1,L0T20W100H20,%ListFile%,ENVI @Edit1=%List1%,%lf%
_END
ENVI ListFile=
ENVI ISOARCH=x86
FIND $%PROCESSOR_ARCHITECTURE%=AMD64,ENVI ISOARCH=x64
FORX \_ISO\WINPE\win10xpe_%ISOARCH%.iso,somefile,0,CALL RecordFile
CALL @Windows1