0%

PowerShell 笔记 [不断更新]

日常用到的powershell命令及脚本

更改文件夹的“修改时间”

1
2
3
$a = Get-Date "02/09/2013 4:59 PM"
$d = [system.io.directoryinfo]"C:\Users\user\Documents\CV"
$d.LastWriteTime = $a

更改文件夹下所有文件“修改时间”

1
2
3
4
5
6
7
$a = Get-Date "2/13/2007 8:00 AM"
$b = Get-ChildItem "C:\Scripts"
foreach ($i in $b)
{
$i.LastWriteTime = $a
$a = $a.AddMinutes(1)
}