如何获取文件的最后修改日期在Windows命令行? [英] How to get file's last modified date on Windows command line?
本文介绍了如何获取文件的最后修改日期在Windows命令行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直使用以下命令获取文件日期。但是,自从我们移动到不同的服务器(Windows Server 2003)以来, fileDate
变量已经返回空值。
FOR / f %% a in('dir myfile.txt ^ | find / imyfile.txt')DO SET fileDate = %% a
有没有其他更可靠的方法来获取文件的日期?
解决方案将
%
更改为%%
以在批处理文件中使用,%〜ta
语法输入call /?
for(MyFile.txt)中的%a设置FileDate =%〜ta
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 Server 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 entercall /?
for %a in (MyFile.txt) do set FileDate=%~ta
这篇关于如何获取文件的最后修改日期在Windows命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文