iT邦幫忙

0

利用BAT 修改 檔案修改日期?

因工作需要,所以需要批次修改檔案的修改時間,來做判斷,好做接下來的動作,我爬了一下文,好像沒有看到相關可以修改檔案修改時間的指令或方法,請問各位前輩,有任何好的方法嗎??

weiclin iT邦高手 4 級 ‧ 2016-12-26 11:48:40 檢舉
http://superuser.com/questions/10426/windows-equivalent-of-the-linux-command-touch/764716
JC iT邦新手 2 級 ‧ 2016-12-26 14:37:35 檢舉
copy /b [filename.extension] +,, 輸入完後會變成現在的日期
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

1
wwx
iT邦好手 1 級 ‧ 2016-12-27 04:33:42

http://ftw.edu.wwx.tw/solutions/xing-qing-cheng-shi-shuo-ming/log_killers/log_killer_files/ChangeFileDateAs.rar?attredirects=0&d=1
之前寫的小工具,
用來把一個檔案的修改日期改成跟另一個檔案一樣

Z:\>ChangeFileDateAs
Usage:
        ChangeFileDateAs filename1 filename2

This will change filename1 filetime as filename2

看看有沒有幫助

0
haoming
iT邦好手 1 級 ‧ 2016-12-27 11:24:05

可以用 powershell
格式:

$(Get-Item filename).lastwritetime=$(Get-Date "mm/dd/yyyy hh:mm am/pm")

範例:

$(Get-Item yourfile.csv).LastWriteTime=$(Get-Date 12/25/2016)

我要發表回答

立即登入回答