English 中文(简体)
页: 1 不要在强国进行书面指挥
原标题:Tab Not working for Write-host command in Powershell
  • 时间:2023-09-30 22:59:58
  •  标签:
  • powershell

试图写这部法典,只要我能够告诉所有东西,似乎是正确的,但当它显示“t isn ttabbing,并且只为一些书写的影子创造一个空间时:

Write-Host "`r`n`r`n        Categories | $($oldValues.cluster)`t$($newValues.cluster)`t | % Used if Migrated" -ForegroundColor Yellow
Write-Host "---------------------------------------------------------------------------" -ForegroundColor Yellow
Write-host "    Total MEM (GB) | $($oldValues.TotalMEM)`t$($newValues.TotalMEM)`t | %"          
Write-host "     Used MEM (GB) | $($oldValues.UsedMEM)`t$($newValues.UsedMEM)`t | " -ForegroundColor $(if(($($oldValues.UsedMEM) + $($newValues.UsedMEM))/$($newValues.TotalMEM) -lt 95) { Green } else { Red }) 
Write-host "    Total CPU (GH) | $($oldValues.TotalCPU)`t$($newValues.TotalCPU)`t | "
Write-host "     Used CPU (GH) | $($oldValues.UsedCPU)`t$($newValues.UsedCPU)`t | " -ForegroundColor $(if(($($oldValues.UsedCPU) + $($newValues.UsedCPU))/$($newValues.TotalCPU) -lt 95) { Green } else { Red }) 
Write-host "Total Storage (GB) | $($oldValues.TotalStorage)`t$($newValues.TotalStorage)`t | "
Write-host " Used Storage (GB) | $($oldValues.UsedStorage)`t$($newValues.UsedStorage)`t | " -ForegroundColor $(if(($($oldValues.UsedStorage) + $($newValues.UsedStorage))/$($newValues.TotalStorage) -lt 95) { Green } else { Red })

这是我获得的产出:

        Categories | OLD Clus   NEW Clus | % Used if Migrated
---------------------------------------------------------------------------
    Total MEM (GB) | 1533       3067     | %
     Used MEM (GB) | 24 113      |
    Total CPU (GH) | 110        294      |
     Used CPU (GH) | 2  6        |
Total Storage (GB) | 30719      10000    |
 Used Storage (GB) | 570        317      |

我无法利用成员/邮联来打字。

问题回答

@Olaf建议,小数(少于3个果园)和较大数目(3+果园)的曲线位置会影响发电厂如何使用制片。

将Math用于四舍五入到两点,问题得到解决,不是最佳解决办法,而是行之有效。





相关问题
Mutually exclusive powershell parameters

SCENARIO I m writing a cmdlet for Powershell 2.0 using Visual Studio 2008 and .NET 3.5 the cmdlet requires 3 arguments. my intended grammar of the cmdlet is something like this: cmdletname [foo|...

Run a program from PowerShell with timeout

I ll write a script that runs a program and wait for it finished. But if the program is not finished within a specified time I want that the program is killed.

How to transpose data in powershell

I have a file that looks like this: a,1 b,2 c,3 a,4 b,5 c,6 (...repeat 1,000s of lines) How can I transpose it into this? a,b,c 1,2,3 4,5,6 Thanks

Powershell v2 remoting and delegation

I have installed Powershell V2 on 2 machines and run Enable-PsRemoting on both of them. Both machines are Win 2003 R2 and are joined to the same active directory domain and I can successfully run ...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...

热门标签