Update Write-an-Extension.md

This commit is contained in:
Belim authored and GitHub committed 2025-09-07 15:47:31 +02:00
1 parent 4250d61c02
commit d34e522d0e
1 file changed
+29 -29
+29 -29
View File
@@ -1,38 +1,38 @@
🆕 Setup Extensions: Host + Options Support
-------------------------------------------
The Setup Extensions system now supports extended script metadata in the header.
# 🆕 Setup Extensions: Host + Options Support
The **Setup Extensions** system now supports extended script metadata in the header.
This allows script authors to define dropdown menus and control how the script is executed.
✅ New Metadata Parameters:
---
# Description: <string>
• Short, user-friendly description of what the script does.
• Displayed in the Extensions page below the title.
## ✅ New Metadata Parameters
# Host: embedded | console
• embedded = run inside OOBE, output is captured and shown in the app.
• console = run in an external PowerShell window with -NoExit.
• Default: embedded (if not specified).
### `# Description: <string>`
- Short, user-friendly description of what the script does.
- Displayed in the Extensions page below the title.
# Options: value1; value2; value3; ...
• Defines multiple selectable actions for a single script.
• A dropdown is automatically shown in the Extensions page.
• The selected value is passed to the script as $choice.
### `# Host: embedded | console`
- **embedded** = run inside OOBE, output is captured and shown in the app.
- **console** = run in an external PowerShell window with `-NoExit`.
- **Default:** `embedded` (if not specified).
Example Script Header:
### `# Options: value1; value2; value3; ...`
- Defines multiple selectable actions for a single script.
- A dropdown is automatically shown in the Extensions page.
- The selected value is passed to the script as `$choice`.
# Description: File Explorer tweaks
# Host: embedded
# Options: Show file extensions; Hide file extensions; Open This PC
---
param([string]$choice)
switch ($choice) {
"Show file extensions" { ... }
"Hide file extensions" { ... }
"Open This PC" { ... }
}
## 📄 Example Script Header
-------------------------------------------
With this update, one script can now provide multiple user actions,
and devs can control whether output stays inside the OOBE app
or opens in a real console window.
```powershell
# Description: File Explorer tweaks
# Host: embedded
# Options: Show file extensions; Hide file extensions; Open This PC
param([string]$choice)
switch ($choice) {
"Show file extensions" { ... }
"Hide file extensions" { ... }
"Open This PC" { ... }
}