如何获得在Windows / DOS命令文件的日期体改 [英] How to get file's modifed date on windows/dos command

查看:296
本文介绍了如何获得在Windows / DOS命令文件的日期体改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用下面的命令来获得文件的日期,但是FILEDATE变量一直以来,我们移动到不同的服务器不断返回空值(Windows 2003中)

I have been using the following command to get the file date, however the fileDate variable has been returning blank value ever since we moved to a different server (windows 2003)

FOR /f %%a in ('dir myfile.txt^|find /i " myfile.txt"')  DO SET fileDate=%%a 

有没有其他更可靠的方式来获得文件的日期?

Is there any other more reliable way to get the file date?

推荐答案

更改%至%%用于批处理文件中使用,用于%〜た语法输入呼叫/?

Change % to %% for use in batch file, for %~ta syntax enter call /?

for %a in (MyFile.txt) do set FileDate=%~ta

这篇关于如何获得在Windows / DOS命令文件的日期体改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆