首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Messagebox中的Powershell脚本LineFeed

Messagebox中的Powershell脚本LineFeed
EN

Stack Overflow用户
提问于 2019-01-31 20:54:53
回答 1查看 153关注 0票数 0

我需要帮助来排序后,在消息框的卷$_.mountpoint输出。

代码语言:javascript
复制
if ((Get-Tpm).TPMReady -eq $true){
    $tpminfo = Get-WmiObject -class Win32_Tpm -namespace root\CIMV2\Security\MicrosoftTpm
    [string]$tpmversion = $tpminfo.PhysicalPresenceVersionInfo 
    [System.Windows.MessageBox]::Show( "TPM Enabled "+$lf+ $lf + "VOLUMES: $lf"+ `
    (Get-BitLockerVolume |select-object mountpoint,VolumeStatus| `
    ForEach-Object {$lf,$_.MountPoint, $_.VolumeStatus}))

} else {
    [System.Windows.MessageBox]::Show( "TPM DISABLED "+$lf+ $lf + "VOLUMES: $lf"+ `
    (Get-BitLockerVolume |select-object mountpoint,VolumeStatus| `
    ForEach-Object {$lf,$_.MountPoint, $_.VolumeStatus}))

    EXIT
}

谢谢马蒂亚斯

EN

回答 1

Stack Overflow用户

发布于 2019-02-01 02:09:21

请尝试使用以下方式插入换行符:

代码语言:javascript
复制
[System.Windows.MessageBox]::Show( "TPM Enabled: $thing`r`nVolumes:$thing")

所以,在你的脚本中,我会这样做(未测试):

代码语言:javascript
复制
[System.Windows.MessageBox]::Show( "TPM DISABLED`r`n`r`nVOLUMES: `r`n" +`
    (Get-BitLockerVolume |select-object mountpoint,VolumeStatus |`
    ForEach-Object {"`r`n" + $_.MountPoint + ": " + $_.VolumeStatus}))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54461112

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档