Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 读取文件夹上次修改日期的powershell脚本_Excel_Date - Fatal编程技术网

Excel 读取文件夹上次修改日期的powershell脚本

Excel 读取文件夹上次修改日期的powershell脚本,excel,date,Excel,Date,我需要一个脚本,读取文件的最后修改日期,由谁修改并输出到excel。我发现了一个脚本,可以更改修改日期 $a = get-date $b = Get-ChildItem "C:\Intel" -recurse | ? { !$_.psiscontainer } foreach ($i in $b) { $i.LastWriteTime = $a } $b 通过检查文件的LastWriteTime属性,可以轻松获取LastWriteTime get-childitem * | sel

我需要一个脚本,读取文件的最后修改日期,由谁修改并输出到excel。我发现了一个脚本,可以更改修改日期

$a = get-date
$b = Get-ChildItem "C:\Intel" -recurse | ? { !$_.psiscontainer }
foreach ($i in $b)
{
    $i.LastWriteTime = $a 
}

$b

通过检查文件的LastWriteTime属性,可以轻松获取LastWriteTime

get-childitem * | select FullName,LastWriteTime,Owner
您可以检查文件的所有者,该所有者可能是也可能不是最后一个要修改的人,具体取决于文件类型。一些办公室文件会将所有者更改为最后一个给他们写信的人,但我不知道这是否可靠

get-childitem * | ForEach-Object {get-acl $_ | select owner}
NTFS不会记录最后一个修改文件的人。您可以打开审核并检查系统审核事件日志,也可以查看filesystemwatcher类并生成监视文件夹更改的自定义脚本。(警告:这可能会导致性能问题。)