我的知识记录

修改word文件时间(图文)

修改Word文件时间可以通过多种方式实现,主要包括修改文件系统时间戳和文档内部属性时间:

方法一:修改文件系统时间戳

Windows 系统:

使用 PowerShell:


 
powershell
# 修改Word文档的修改时间 $file = Get-Item "C:\path\to\your\document.docx" $file.LastWriteTime = "2024-01-01 12:00:00" # 修改创建时间 $file.CreationTime = "2024-01-01 12:00:00" # 修改访问时间 $file.LastAccessTime = "2024-01-01 12:00:00"

使用命令提示符(配合工具):


 
cmd
# 需要安装第三方工具如 touch for Windows touch -m -t 202401011200 document.docx

macOS/Linux 系统:


 
bash
# 修改修改时间 touch -m -t 202401011200 document.docx # 修改访问时间 touch -a -t 202401011200 document.docx

方法二:修改Word文档内部属性

通过Word界面:

  1. 打开Word文档
  2. 点击「文件」选项卡
  3. 选择「信息」
  4. 点击右侧的「属性」下拉菜单
  5. 选择「高级属性」
  6. 在弹出窗口中可以查看和修改各种时间属性

通过VBA宏代码:


 
vba
Sub ModifyDocumentProperties() Dim doc As Document Set doc = ActiveDocument ' 修改内置文档属性 doc.BuiltInDocumentProperties("Creation Date") = "2024-01-01 12:00:00" doc.BuiltInDocumentProperties("Last Save Time") = "2024-01-01 12:00:00" End Sub

方法三:使用Python脚本


 
python
from win32com.client import Dispatch import os import time from datetime import datetime # 修改文件系统时间戳 def change_file_timestamp(filepath, new_time): timestamp = time.mktime(new_time.timetuple()) os.utime(filepath, (timestamp, timestamp)) # 修改Word文档属性 def change_word_properties(filepath, creation_time, modify_time): word = Dispatch("Word.Application") word.Visible = False doc = word.Documents.Open(filepath) # 修改文档属性 doc.BuiltInDocumentProperties(12).Value = creation_time # 创建时间 doc.BuiltInDocumentProperties(13).Value = modify_time # 修改时间 doc.Save() doc.Close() word.Quit() # 使用示例 filepath = r"C:\path\to\your\document.docx" new_time = datetime(2024, 1, 1, 12, 0, 0) change_file_timestamp(filepath, new_time) # change_word_properties(filepath, new_time, new_time) # 需要安装pywin32

方法四:使用第三方工具

推荐几款实用工具:
  • Attribute Changer - 图形化界面修改文件属性
  • Bulk File Changer - 批量修改多个文件时间
  • NirSoft FileDateChanger - 免费轻量级工具

注意事项

  1. 备份文件:修改前请备份重要文档
  2. 权限问题:确保有足够的权限修改文件
  3. 云同步影响:OneDrive、Google Drive等可能会恢复原始时间
  4. 兼容性:不同版本的Word可能有不同的属性结构
  5. 法律风险:修改文档时间可能涉及法律问题,请谨慎操作
您希望修改哪一种具体的时间属性?是文件系统时间还是Word文档内部属性?
 

修改word文件时间(图文)

标签:

更新时间:2025-12-17 13:36:12

上一篇:修改文档保存时间(图文)

下一篇:怎么修改文档时间(图文)