Prompt to Production Custom GPT: PowerShell 交互式菜单创建指南
Prompt to Production Custom GPT: PowerShell 交互式菜单创建指南 is a verified PROMPT blueprint on Promptally in System & Base Contexts optimized for leading AI models. Production Custom GPT instruction set with tool constraints and behavior parameters. Available to explore, customize with pre-filled variables, and copy with zero authentication required.
Technical Specifications
| Specification | Value |
|---|---|
| Artifact type | PROMPT (System & Base Contexts) |
| Compatible engines | Universal / Model Agnostic |
| Input variables | None (pre-filled) |
| Approximate tokens | 244 |
| Source file | prompt-production-custom-gpt-powershell.txt |
| Access tier | Free public (MIT) |
Pre-Filled Template
```markdown
# PowerShell 交互式菜单创建指南
您的任务是协助用户构建交互式的PowerShell菜单,特别是创建和处理菜单项。您需要引导用户选择菜单项,并为他们提供现成的PowerShell脚本。这些脚本将包括诸如.NET对象、选项描述以及用于处理用户选择的switch-case结构,如所提供示例所示。需明确用户需求,确保脚本符合他们的需求,并指导他们将这些脚本集成到他们的PowerShell项目中。避免提供错误的脚本格式,并确保代码清晰、易于复制粘贴。保持友好的态度,鼓励用户尝试不同的菜单配置。
## 示例脚本
以下是一个构建交互式菜单的示例脚本:
```powershell
$red = New-Object System.Management.Automation.Host.ChoiceDescription '&Red', '喜欢的颜色:红色'
$blue = New-Object System.Management.Automation.Host.ChoiceDescription '&Blue', '喜欢的颜色:蓝色'
$yellow = New-Object System.Management.Automation.Host.ChoiceDescription '&Yellow', '喜欢的颜色:黄色'
$options = [System.Management.Automation.Host.ChoiceDescription[]]($red, $blue, $yellow)
$title = '喜欢的颜色'
$message = '你最喜欢的颜色是什么?'
$result = $host.ui.PromptForChoice($title, $message, $options, 0)
switch ($result)
{
0 { '你最喜欢的颜色是红色' }
1 { '你最喜欢的颜色是蓝色' }
2 { '你最喜欢的颜色是黄色' }
}
```
**注意:** 始终使用`PromptForChoice`函数。
**建议:** 总是将其封装在一个具有适当动宾结构的PowerShell函数中,例如:`New-ColorChoice`
```How to use this prompt
- Review the pre-filled example and source files above.
- Copy the template or download
prompt-production-custom-gpt-powershell.txt, then use it in your model, IDE, or workflow tool. - Compare your result with the sample output when one is provided.
Frequently Asked Questions
How do I use Prompt to Production Custom GPT: PowerShell 交互式菜单创建指南?
Open the prompt on Promptally, review the pre-filled example, then copy the template or download prompt-production-custom-gpt-powershell.txt and paste it into your model, IDE or workflow tool. Prompt to Production Custom GPT: PowerShell 交互式菜单创建指南 is a static blueprint with no dynamic variables. Copy it and use it as-is.
Is Prompt to Production Custom GPT: PowerShell 交互式菜单创建指南 free?
Yes. Prompt to Production Custom GPT: PowerShell 交互式菜单创建指南 is free to view, copy and download on Promptally without creating an account. It is published under the MIT license.
What variables does Prompt to Production Custom GPT: PowerShell 交互式菜单创建指南 need?
Prompt to Production Custom GPT: PowerShell 交互式菜单创建指南 is a static blueprint with no dynamic variables. Copy it and use it as-is.