- PowerShell 教程
- PowerShell - 首頁
- PowerShell - 概述
- PowerShell - 環境設定
- PowerShell - Cmdlet
- PowerShell - 檔案和資料夾
- PowerShell - 日期和計時器
- PowerShell - 檔案輸入/輸出
- PowerShell - 高階 Cmdlet
- PowerShell - 指令碼
- PowerShell - 特殊變數
- PowerShell - 運算子
- PowerShell - 迴圈
- PowerShell - 條件
- PowerShell - 陣列
- PowerShell - 雜湊表
- PowerShell - 正則表示式
- PowerShell - 反引號
- PowerShell - 括號
- PowerShell - 別名
- PowerShell 有用的資源
- PowerShell - 快速指南
- PowerShell - 有用的資源
- PowerShell - 討論
Powershell - 獲取系統時間
Cmdlet
Get-Date cmdlet 用於獲取系統日期時間。
示例 1
在此示例中,我們在沒有任何引數的情況下使用 Get-Date
在 PowerShell ISE 控制檯中鍵入以下命令
Get-Date
輸出
您可以在 PowerShell 控制檯中看到以下輸出。
Get-Date Wednesday, April 04, 2018 5:24:51 PM
示例 2
在此示例中,我們使用 -DisplayHint 來僅列印時間。
在 PowerShell ISE 控制檯中鍵入以下命令
Get-Date -DisplayHint Time
輸出
您可以在 PowerShell 控制檯中看到以下輸出。
Get-Date -DisplayHint Date 5:26:36 PM
powershell_dates_timers.htm
廣告