Beispiel 5: Abrufen von Formatierungsdaten basierend auf der angegebenen Version von PowerShell In diesem Beispiel wird gezeigt, wieGet-FormatDataSie Formatdaten für eine angegebeneTypeName- und PowerShell-Version abrufen. PowerShell Get-FormatData-TypeName'Microsoft.Powershell.Utility.FileHash'-Powe...
以上代码中,首先使用Get-Date函数获取当前日期和时间,并通过-Format参数指定日期和时间的格式为"yyyyMMdd_HHmmss",例如"20220520_153012"。然后,将日期和时间戳拼接到文件名中,如"myfile_20220520_153012.txt"。最后,使用New-Item命令创建一个新的文件,使用-ItemType File参数指定文件类型为普通文件,使用-Path参数指...
Die Formatierungsdaten in den Dateien definieren die Anzeige von Microsoft .NET Framework-Objekten in der Sitzung.Beim Starten von PowerShell werden die Formatdaten aus dem PowerShell-Quellcode geladen. Sie können jedoch benutzerdefinierte Format.ps1xml-Dateien erstellen, um die Formatierung ...
Get-Date -format D Etc., etc. If you want to, you can also assign this formatted date-time value to a variable, like so: $a = Get-Date -format M Do that and display the value of $a; you should get back something that looks like this: ...
Get-Date -Format 'H时:m分:s秒' | Out-File -Append "G:\开机查询\开机时间查询.txt"然后将其保存为“kaiji.ps1”,放置在“G:\开机查询”文件夹中备用(图1)。命令解释:第一行命令是把“Get-Date”当作一个变量,使用"$()"进行引用,日期使用“年月日”的格式(表示开机日期),并将该内容以...
\-(\d{2})/; var date = str.replace(reg,"$1年$2月$3日"); alert(date); 2....
PC />Get-Date|Format-ListDayOfWeek,{$_/$null}-DisplayErrorDayOfWeek : Friday$_/$null:#ERRPC />Get-Date|Format-ListDayOfWeek,{$_/$null}-ShowErrorDayOfWeek : Friday$_/$null: Failed to evaluate expression"$_/$null". + CategoryInfo : InvalidArgument: (12/21/20187:59:23AM:PSObjec...
此命令以定制化的备用视图格式化有关Winlogon进程的信息。 由于命令不使用View参数,因此Format-Custom使用默认自定义视图设置数据的格式。 示例3:解决格式错误 以下示例显示了使用表达式添加DisplayError或ShowError参数的结果。 PowerShell PC />Get-Date|Format-CustomDayOfWeek,{$_/$null}-DisplayErrorclass DateTime { ...
Get-Date [[-Date] <DateTime>] [-Year <Int32>] [-Month <Int32>] [-Day <Int32>] [-Hour <Int32>] [-Minute <Int32>] [-Second <Int32>] [-Millisecond <Int32>] [-DisplayHint <DisplayHintType>] [-Format <String>] [-AsUTC] [<CommonParameters>]Power...
Export-FormatData Export-PSSession Format-Custom Format-Hex Format-List Format-Table Format-Wide Get-Alias Get-Culture Get-Date Get-Error Get-Event Get-EventSubscriber Get-FileHash Get-FormatData Get-Host Get-MarkdownOption Get-Member Get-PSBreakpoint ...