Get-Date[[-Date] <DateTime>] [-Year <Int32>] [-Month <Int32>] [-Day <Int32>] [-Hour <Int32>] [-Minute <Int32>] [-Second <Int32>] [-Millisecond <Int32>] [-DisplayHint <DisplayHintType>] [-Format <String>] [-AsUTC] [<CommonParameters>] ...
Foreach($formatin"d","D","f","F","g","G","m","r","s","t","T", ` "u","U","y","dddd, MMMM dd yyyy","M/yy","dd-MM-yy") { "PowerShell 日期格式, 使用 $format : {0}"-f$date.ToString($format) } 输出: PowerShell 日期格式,使用 d : 2013/6/6 PowerShell 日期...
Dates are an essential part of several applications and scripts. Still, the date information is usually stored in string format, which makes it difficult to perform operations such as date arithmetic or comparison. Therefore you need to convert strings to dates; this will make it easier to perfo...
5.Get-Job : 获取在当前会话中运行的 Windows PowerShell 后台作业 6.Get-FormatData : 获取当前会话中的格式数据 7.Get-Event : 获取事件队列中的事件 8.Get-Alias : 获取当前会话的别名 9.Get-Culture :获取操作系统中设置的当前区域性 Get-Date :获取当前日期和时间 Get-Host : 获取表示当前主机程序的对...
PC /> Get-Date | Format-List DayOfWeek,{ $_ / $null } -DisplayError DayOfWeek : Friday $_ / $null : #ERR PC /> Get-Date | Format-List DayOfWeek,{ $_ / $null } -ShowError DayOfWeek : Friday $_ / $null : Failed to evaluate expression " $_ / $null ". + CategoryInfo ...
Select-String Select-Xml Send-MailMessage Set-Alias Set-Date Set-MarkdownOption 在6.1 中添加 Set-PSBreakpoint Set-TraceSource Set-Variable Show-Command 仅限Windows Show-Markdown 在6.1 中添加 Sort-Object Start-Sleep Tee-Object Test-Json Trace-Command Unblock-File 7\.0 中新...
PC /> Get-Date | Format-List DayOfWeek,{ $_ / $null } -DisplayError DayOfWeek : Friday $_ / $null : #ERR PC /> Get-Date | Format-List DayOfWeek,{ $_ / $null } -ShowError DayOfWeek : Friday $_ / $null : Failed to evaluate expression " $_ / $null ". + CategoryInfo : In...
First, we created a variable and assigned the date and time string. After that, we used the cased created variable in the “DateTime” format: The output confirms that the specified string has been converted to DateTime in PowerShell.
{ $_ / $null } -DisplayError DayOfWeek $_ / $null --- --- Wednesday #ERR Get-Date | Format-Table DayOfWeek,{ $_ / $null } -ShowError DayOfWeek $_ / $null --- --- Wednesday InvalidArgument: Failed to evaluate expression " $_ / $null ".参数-AutoSize指示cmdlet 根据数据的宽度...
PS>Get-CultureLCID Name DisplayName --- --- ---1031de-DEGerman (Germany) PS>$x=1.2PS>$x.ToString()1,2PS> (Get-Date2024-03-19).ToString()19.03.202400:00:00 그러나 PowerShell은 확장 가능한 문자열 식을 해석할 때 고정 문화권을 사용...