从日期中获取日期名称
Get the day's name From a date
我想显示给定日期的星期几。我有一个代码可以根据系统日期给我名字的日期。
@for /F "tokens=1 delims=, " %%i In ('powershell date') do set dow=%%i
echo %dow%
我怎样才能显示我要输入的任何日期的日期名称?
我想做这样的事情(我已经在之前设置了变量日,月和年):
@for /F "tokens=1 delims=, " %%i In ('powershell %day%/%month%/%year%') do set dow=%%i
echo %dow%
改编自https://technet.microsoft.com/en-us/library/ff730960.aspx:
for /f "delims=" %%d in ('powershell (get-date %day%/%month%/%year%^).dayofweek') do set dow=%%d
出于测试目的:
@echo off
:...
echo Command line: powershell (get-date %day%/%month%/%year%).dayofweek
echo Result:
powershell (get-date %day%/%month%/%year%).dayofweek
for /f "delims=" %%d in ('powershell (get-date %day%/%month%/%year%^).dayofweek') do set dow=%%d
echo dow=%dow%
我想显示给定日期的星期几。我有一个代码可以根据系统日期给我名字的日期。
@for /F "tokens=1 delims=, " %%i In ('powershell date') do set dow=%%i
echo %dow%
我怎样才能显示我要输入的任何日期的日期名称? 我想做这样的事情(我已经在之前设置了变量日,月和年):
@for /F "tokens=1 delims=, " %%i In ('powershell %day%/%month%/%year%') do set dow=%%i
echo %dow%
改编自https://technet.microsoft.com/en-us/library/ff730960.aspx:
for /f "delims=" %%d in ('powershell (get-date %day%/%month%/%year%^).dayofweek') do set dow=%%d
出于测试目的:
@echo off
:...
echo Command line: powershell (get-date %day%/%month%/%year%).dayofweek
echo Result:
powershell (get-date %day%/%month%/%year%).dayofweek
for /f "delims=" %%d in ('powershell (get-date %day%/%month%/%year%^).dayofweek') do set dow=%%d
echo dow=%dow%