我能用Windows PowerShell做什么:检查计算机的日期与时间
来源:互联网 发布:淘宝要怎么推广 编辑:程序博客网 时间:2024/04/27 12:26
注:本篇文章,未在联系作者以及得到许可的情况下, 禁止以任何形式进行转载。
By:Anders Mail:katrina520@163.com
改变一台计算机的日期与时间
在解释如何使用这个最新Set-Date cmdlet以前,我们应该注意到,这是一个cmdlet。你应该小心使用。 举个例子来说,如果你在活动目录环境下,你的工作站必须密切配合你的域控制器;如果他们并非这样,你可能无法登录到域。电脑的时间是经常被指派使用一个自动时间服务;在这种情况下,你也许并不必(或许不应该)手动来设定日期和时间。
当然,如果你需要设定日期和时间,那么Set-Date可以提供一个简单的方法来这样做。
一个可以改变一台计算机上的日期/时间的方法就是使用 -date参数来更新日期和时间。举个例子,假设你要设定的日期和时间是在2006年6月1日的上午8:30。这里你可以这样做:
Set-Date –date "6/1/2006 8:30 AM"
需要设定的时钟刚好要提前两天?可以使用Get-Date cmdlet这个命令和AddDays方法来提前时钟两天:
Set-Date (Get-Date).AddDays(2)
也可以在这里用其它方法,包括AddHours ,AddMinutes 和Addseconds . 需要设定倒流1小时(夏令时)来节约时间? 那么只需要设置倒流 -1 (减1 ) 小时,象这样:
Set-Date (Get-Date).AddHours(-1)
另外,你也可以使用-adjust参数以格式:小时:分:秒 来调整。 举个例子,这个命令集把时钟提前了1小时37分:
Set-Date –adjust 1:37:0
英文原文:http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/set-date.mspx
- 我能用Windows PowerShell做什么:检查计算机的日期与时间
- 我能用Windows PowerShell做什么:检查计算机的日期与时间
- 我能用Windows PowerShell做什么:日期与时间信息清单
- 我能用Windows PowerShell做什么:日期与时间信息清单
- 我能用Windows PowerShell做什么:执行日期算法
- 我能用Windows PowerShell做什么:执行日期算法
- 我能用Windows PowerShell做什么:列出特殊的成员
- 我能用Windows PowerShell做什么:过滤返回的数据
- 我能用Windows PowerShell做什么:保存 Windows PowerShell 别名
- 我能用Windows PowerShell做什么:暂停 Windows PowerShell 脚本
- 我能用Windows PowerShell做什么:创建一个新的 Windows PowerShell 别名
- 我能用Windows PowerShell做什么:列出你所有的 Windows PowerShell 别名
- 我能用Windows PowerShell做什么:复制文件或文件夹
- 我能用Windows PowerShell做什么:重命名文件和文件夹
- 我能用Windows PowerShell做什么:检索一个特定项目
- 我能用Windows PowerShell做什么:检索数字签名
- 我能用Windows PowerShell做什么:基本统计计算
- 我能用Windows PowerShell做什么:核实是否存在的文件或文件夹
- net sql连接字符串详解
- 浙大计算机专业课复习建议
- 系统集成项目招标要诀
- 体验DNNing。。。实在是太酷了
- C#基本语法浓缩一
- 我能用Windows PowerShell做什么:检查计算机的日期与时间
- 详解spring事务属性
- Chapter 13 of "C++ Templates" Done
- 解惑 spring 嵌套事务
- 批处理符号 学习
- 心事,难受,为什么
- 只让指定的机器连接SQLServer服务器
- pvpgn 1.8.0-1 重编译版本(bugfixed:系统启动时连接mysql可能会失败的bug)[更新1.8.1]
- .和->的区别