1
I call the following program from within another command line prog...
:: NT_getdate.cmd return yumd-date in var='ymd'
@echo on
setlocal
for /F "tokens=2,3,4 delims=/ " %%g in ('echo.^|date /t') do (
set dd=%%g
set mm=%%h
set yy=%%i
)
endlocal& set ymd=%yy%%mm%%dd%
When I run the progam from within command line ymd is returned as "20160501" which is what I want.
When I run the top program from Task Scheduler the result I get is "1605"
Any ideas?
my guess is that the user running the command via task scheduler has a different environment than your desktop user does. have you tried scheduling the task under your own user? – Frank Thomas – 2016-05-01T06:44:55.313
have you tried just running
date /t
and then the pause command and compare the formats between batch file within cmd, and task scheduler – barlop – 2016-05-01T06:46:01.620