- 获得下一分钟的时间:
PS C:\> get-date -DisplayHint time
4:16:33
PS C:\> echo $(get-date -displayhint time).AddMinutes(1).toString()
2007-10-7 4:17:35
- 单位换算:
PS C:\> 1+1KB+1MB+1GB
1074791425
- 获取磁盘剩余空间:
PS C:\> Get-WMIObject Win32_LogicalDisk | ForEach-Object {$_.name,[math]::truncate($_.freespace / 1MB)}
C:
1021
D:
6276
E:
4170
F:
4330
G:
2032
- 向标准输出写警告:
PS C:\> Write-Warning "The folder C:\Scripts2 does not exist."
警告: The folder C:\Scripts2 does not exist.