【发布时间】:2018-02-12 12:52:54
【问题描述】:
我想在 Visual Studio Code 中执行一些 powershell 脚本(简单的)。
当我用 F5 运行它时,VSC 会变成橙色(调试模式)几秒钟,然后又恢复正常,没有显示任何东西。
这是控制台输出:
PS C:\Users\Huberdo\Documents\WindowsPowerShell> c:\Users\Huberdo\Documents\Meine Projekte\HD-Powershell-Scripts\Mailbox\HD-Mailbox.ps1
PS C:\Users\Huberdo\Documents\Meine Projekte\HD-Powershell-Scripts\Mailbox>
脚本应该要求我选择Write-Host,但它没有。
这是主要脚本:
function Show-Menu() {
Write-Host "================ $Title ================"
Write-Host "1: Press '1' for this option."
Write-Host "2: Press '2' for this option."
Write-Host "3: Press '3' for this option."
Write-Host "Q: Press 'Q' to quit."
do {
Show-Menu
$input = Read-Host "Please make a selection"
switch ($input) {
'1' {
cls
'You chose option #1'
} '2' {
cls
'You chose option #2'
} '3' {
cls
'You chose option #3'
} 'q' {
return
}
}
pause
}
until ($input -eq 'q')
}
我已经安装并激活了 Powershell 扩展。 我在 Stackoverflow 上搜索并搜索了可能的解决方案或类似问题,但找不到任何解决方案。
我做错了吗?我用 x86 和 x64 PS 尝试过。
【问题讨论】:
标签: powershell visual-studio-code