Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PowerShell中格式化数字以删除&引用;对于数字>;1k?_Powershell_Formatting_Numbers_Powershell 2.0_Powershell 3.0 - Fatal编程技术网

在PowerShell中格式化数字以删除&引用;对于数字>;1k?

在PowerShell中格式化数字以删除&引用;对于数字>;1k?,powershell,formatting,numbers,powershell-2.0,powershell-3.0,Powershell,Formatting,Numbers,Powershell 2.0,Powershell 3.0,我读了关于格式的页面,但我的需求有点不同 如果我对大于1000的数字使用数字格式,我会得到如下结果: $x = 1000 "{0:N2}" -f $x = 1,000.00 但我需要的是:1000.00,因为我不能在这里使用逗号 那么,我该如何使它工作呢?这应该满足您的需要 '{0:f2}' -f 1000 不要使用N格式说明符。改用F(定点): 在所有标准的.NET数字格式说明符上都可以看到这一点。有趣的是,它取决于系统语言。因此,对于我们来说,它是1000.86,德国是1000.86,

我读了关于格式的页面,但我的需求有点不同

如果我对大于1000的数字使用数字格式,我会得到如下结果:

$x = 1000
"{0:N2}" -f $x
 = 1,000.00
但我需要的是:1000.00,因为我不能在这里使用逗号


那么,我该如何使它工作呢?

这应该满足您的需要

'{0:f2}' -f 1000

不要使用
N
格式说明符。改用
F
(定点):


在所有标准的.NET数字格式说明符上都可以看到这一点。

有趣的是,它取决于系统语言。因此,对于我们来说,它是1000.86,德国是1000.86,使用相同的格式。是否有一种格式可以切换到我们?ahh找到了关于此的其他答案:)
C:\PS> "{0:F2}" -f 1000
1000.00