如何找到通过批量上周日DATE [英] HOW to find last SUNDAY DATE through batch

查看:138
本文介绍了如何找到通过批量上周日DATE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过批处理命令找到上周日DATE'
我试图为

How to find 'last SUNDAY DATE' through batch command? what I was trying is

echo %date:~4,2%%date:~7,2%%date:~10,4%

这是很好的当前日期
但上周日的日期......任何人都可以通过批量提出任何逻辑。

this is good for current date but for last Sunday date... can anyone suggest any logic through batch.

推荐答案

的Windows PowerShell:

Windows PowerShell:

[DateTime]::Now.AddDays(-1 * [DateTime]::Now.DayOfWeek.value__)

对不起环境变量%DATE%在批处理(.bat)文件,声音不易做计算。

Sorry the environment variable %date% in Batch (.bat) files sounds uneasy to do calculations.

这篇关于如何找到通过批量上周日DATE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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