|
-- 启动命令
os.run('explorer.exe'), os.exec()
-- 创建快捷方式
Desktop:Link(), Startmenu:Link(), Taskbar:Pin(), Startmenu:Pin()
pecmd.lua 完整例子:
- local function OSInit()
- -- show cursor, and wpeinit.exe
- os.exec('/wait', '%WinDir%\\System32\\winpeshl.exe')
- -- // Load Display drivers
- os.exec('/wait /hide', [[Drvload.exe %WinDir%\inf\basicdisplay.inf %WinDir%\inf\basicrender.inf %WinDir%\inf\c_display.inf %WinDir%\inf\display.inf %WinDir%\inf\displayoverride.inf]])
- -- // Try resolution(s)
- Screen:DispTest({'1024x768', '1152x864', '1366x768'})
- File.delete('X:\\Users\\Public\\Desktop\\desktop.ini')
- end
- local function PreShell()
- -- LetterSwap
- -- // exec('/wait /hide', [[LetterSwap.exe /auto /bootdrive Y:\CDUsb.y /Log %WinDir%\System32\LetterSwap.log]])
- -- Load oem drivers before shell in background
- -- os.exec('/hide', [[%WinDir%\System32\pnputil.exe /add-driver %WinDir%\inf\oem*.inf]])
- -- Prepare environment variables
- local homeprofile = 'X:\\Users\\Default'
- if logon_user ~= 'SYSTEM' then
- homeprofile = 'X:\\Users\\' .. logon_user
- end
- os.setenv('HOMEPROFILE', homeprofile) -- only for PE
- os.setenv('Desktop', homeprofile .. '\\Desktop')
- os.setenv('Programs', homeprofile .. [[\AppData\Roaming\Microsoft\Windows\Start Menu\Programs]])
- -- shortcuts
- Desktop:Link('7-Zip.lnk', [[%ProgramFiles%\7-Zip\7zGM.exe]])
- Desktop:Link('#{@shell32.dll,22067}.lnk', 'Explorer.exe')
- Desktop:Link('#{@shell32.dll,22022}.lnk', 'cmd.exe')
- Desktop:Link('Internet Explorer.lnk', '%ProgramFiles%\\Internet Explorer\\iexplore.exe')
- Startmenu:Link('管理工具\\设备管理器.lnk', 'devmgmt.msc')
- Startmenu:Link('管理工具\\磁盘管理器.lnk', 'diskmgmt.msc')
- end
- local function LoadShell()
- os.exec('PECMD.EXE EXEC -su ctfmon.exe')
- os.exec('WinXShell.exe -daemon')
- os.run('Explorer.exe')
- end
- local function PostShell()
- Taskbar:WaitForReady()
- Taskbar:Pin('%ProgramFiles%\\WinXShell\\WinXShell.exe', 'UI_Shutdown', '-ui -jcfg wxsUI\\UI_Shutdown.zip\\full.jcfg -blur 5', 'shell32.dll', 27)
- Taskbar:Pin('Explorer.exe')
- Taskbar:Pin('cmd.exe')
- Startmenu:Pin('X:\\Windows\\System32\\notepad.exe')
- end
- local function main()
- OSInit()
- PreShell()
- LoadShell()
- PostShell()
- -- loader keeper
- os.exec('/wait /hide', 'cmd.exe /k echo alive')
- end
- main()
复制代码 |
|