Add sample config files in PreShellConfig docs

Homes32
2025-02-19 21:36:46 -06:00
parent 4ea49586a8
commit 8132b87500

@@ -43,9 +43,148 @@ By placing a specifically named script in a pre-defined location these scripts w
| PhoenixPE-UserConfig.wcz | `%TargetDir%\System32` | Compressed/Encrypted PECMD script packed in boot.wim. |
| PhoenixPE-UserConfig.wcz | `%OutputDir%\PhoenixPE` | Compressed/Encrypted PECMD script included on boot media (CD/USB). |
#### Sample Config files
**Autoit3 Script using PhoenixPE extensions**
```
#NoTrayIcon
; This is a user defined PhoenixPE configuration file.
; It will be executed during the PhoenixPE Pre-Shell config.
AutoItSetOption("ExpandEnvStrings", 1)
; Main
Config()
Shortcuts()
LoadDrivers()
RunPrograms()
Func Config()
SetSplashText("Additional configuration in progress...")
RegWrite("HKEY_LOCAL_MACHINE\Software\Example", "Key1", "REG_SZ", "This is an example of RegWrite")
EndFunc ;==>Config
Func Shortcuts()
SetSplashText("Creating additional shortcuts...")
MakeShortcut("%WinDir%\myProgram.exe", @ProgramsCommonDir & "\MyProgram.lnk")
EndFunc ;==>Shortcuts
Func LoadDrivers()
SetSplashText("Loading additional drivers...")
RunProgramWait(@SystemDir & "\Drvload.exe %WinDir%\inf\basicdisplay.inf", "", @SW_HIDE)
RunProgram(@SystemDir & "\pnputil.exe", "/add-driver %WinDir%\inf\hdaudio.inf /install", "", @SW_HIDE)
EndFunc ;==>LoadDrivers
Func RunPrograms()
SetSplashText("Running additional programs...")
RunProgramWait("Y:\Autorun.cmd", "", "", @SW_HIDE)
RunProgram("Y:\Programs\Sysinternals\procmon.exe")
EndFunc ;==>RunPrograms
```
**Autoit3 Script using pure Autoit functions**
```
#NoTrayIcon
; This is a user defined PhoenixPE configuration file.
; It will be executed during the PhoenixPE Pre-Shell config.
AutoItSetOption("ExpandEnvStrings", 1)
; Main
Config()
Shortcuts()
LoadDrivers()
RunPrograms()
SplashOff()
Func Config()
SplashTextOn("", "Additional configuration in progress...", 500, 50, -1, 600, 1)
RegWrite("HKEY_LOCAL_MACHINE\Software\Example", "Key1", "REG_SZ", "This is an example of RegWrite")
EndFunc ;==>Config
Func Shortcuts()
SplashTextOn("", "Creating additional shortcuts...", 500, 50, -1, 600, 1)
FileCreateShortcut("%WinDir%\myProgram.exe", @ProgramsCommonDir & "\MyProgram.lnk")
EndFunc ;==>Shortcuts
Func LoadDrivers()
SplashTextOn("", "Loading additional drivers...", 500, 50, -1, 600, 1)
RunWait(@SystemDir & "\Drvload.exe %WinDir%\inf\basicdisplay.inf", @SW_HIDE)
Run(@SystemDir & "\pnputil.exe", "/add-driver %WinDir%\inf\hdaudio.inf /install", "", @SW_HIDE)
EndFunc ;==>LoadDrivers
Func RunPrograms()
SplashTextOn("", "Running additional programs...", 500, 50, -1, 600, 1)
RunWait("Y:\Autorun.cmd", "", @SW_HIDE)
Run("Y:\Programs\Sysinternals\procmon.exe")
EndFunc ;==>RunPrograms
```
**PECMD Script**
```
// This is a user defined PECMD configuration file.
// It will be executed during the PhoenixPE Pre-Shell config.
CALL Config
CALL Shortcuts
CALL LoadDrivers
CALL RunPrograms
WAIT 3000
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB Config
TEXT Additional configuration in progress...#0xFFFFFF L59 T39 $20
DISP W1024 H768 B32 F60
_END Config
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB Shortcuts
TEXT Creating additional shortcuts...#0xFFFFFF L59 T39 $20
LINK %Programs%\Explorer,%WinDir%\myProgram.exe
_END Shortcuts
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB LoadDrivers
TEXT Loading additional drivers...#0xFFFFFF L59 T39 $20
DEVI %WinDir%\inf\xxxxx.inf
_END LoadDrivers
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB RunPrograms
// Syntax: EXEC <State><PathToExe> [WorkingDir]
// <State>: = - Wait
// @ - Background
// ! - Hide
// Example:
// EXEC =WaitNoHide.cmd - Execute WaitNoHide.cmd and wait until it is finished before continuing
// EXEC @!=WaitHide.cmd - Execute WaitHide.cmd, hide the window and wait until it is finished before continuing.
// EXEC NoWaitNoHide.cmd - Execute NoWaitNoHide.cmd and continue with the next command.
// EXEC @!NoWaitHide.cmd - Execute NoWaitHide.cmd, hide the window and continue with the next command.
TEXT Running additional programs...#0xFFFFFF L59 T39 $20
EXEC @!Y:\Autorun.cmd
EXEC Y:\Programs\Sysinternals\procmon.exe
_END RunPrograms
```
### AddAutoRun
You may also choose to run AutoIt3 or PECMD scripts directly at different startup stages using the `AddAutoRun` command.
For more flexibility, you may choose to run AutoIt3 or PECMD scripts directly at different startup stages using the `AddAutoRun` command.
**Example**