[array],[bool],[byte],[char],[datetime],[decimal],[double],[guid],[hashtable],[int16],[int32],[int],[int64],[long],[nullable],[psobject],[regex],[sbyte].[scriptblock],[single],[float],[string],[switch],[timespan],[type],[uint16],[uint32],[uint64],[ XML ] 变量的幕后...
ScriptBlock 包含表示当前管道对象的 $_ 变量。 时间戳字符串由用句点替换的冒号分隔。 New-Item 使用Path 参数来指定新目录的位置。 路径包含 $timestamp 变量作为目录名称。 Type 参数指定创建目录。示例9:转换 Unix 时间戳本示例将 Unix 时间(由自 1970-01-01 01 0:00:00 以来的秒数)转换为 DateTime。
[DateTime]::UtcNow$record="AzureActiveDirectory"$resultSize=5000$intervalMinutes=60#Start script[DateTime]$currentStart=$start[DateTime]$currentEnd=$endFunctionWrite-LogFile([String]$Message) {$final= [DateTime]::Now.ToUniversalTime().ToString("s") +":"+$Message$final|Out-File$logFile-Append}...
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...
gi 获取指定的文件或者目录 Get-Item gp 获取文件或目录的属性 Get-ItemProperty ii 使用对应的默认windows程序运行文件或者目录 Invoke-Item — 连接两个路径为一个路径 Join-Path mi, mv, move 移动文件或者目录 Move-Item ni 创建新文件或者目录 New-Item ri, rm, rmdir,del, erase, rd 删除空目录或者文件...
For example, you need to know the current date and time of theAUS Eastern Standard Time. [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId([DateTime]::Now,"AUS Eastern Standard Time") Note: This works only if the given time zone is available on your local system....
此命令返回有关当前区域性的 DateTimeFormat 的详细信息,该区域性用于 Windows PowerShell。 主机对象的CurrentCulture属性包含CultureInfo对象,而该对象又具有许多有用的属性。 其中,DateTimeFormat属性包含具有许多有用属性的DateTimeFormatInfo对象。 若要查找存储在对象属性中的对象的类型,请使用Get-Membercmdlet。 若要显...
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...
param( [Parameter(Mandatory)] [ValidateScript( {$_ -ge (Get-Date)}, ErrorMessage = "{0} isn't a future date. Specify a later date." )] [DateTime]$EventDate ) Ha a megadott érték múltbeli dátum, az egyéni hibaüzenet jelenik meg. Output Másolás Cannot validat...
<String> -replace <regular-expression>, {<Script-block>} 在脚本块中,使用 $_ 自动变量访问要替换的输入文本和其他有用信息。 此变量的类类型为 System.Text.RegularExpressions.Match。 以下示例将每个三位数字的序列替换为字符等效项。 脚本块针对需要替换的每个三位数字集运行。 PowerShell 复制 "072101108...