How do I capture the output of a script if it is being ran by the task scheduler?

前端 未结 9 800
旧巷少年郎
旧巷少年郎 2020-12-02 08:37

Using Windows Server 2008, how do I go about capturing the output of a script that is being ran with the windows task scheduler?

I\'m testing a rather long custom pr

9条回答
  •  攒了一身酷
    2020-12-02 09:19

    This snippet uses wmic.exe to build the date string. It isn't mangled by locale settings

    rem DATE as YYYY-MM-DD via WMIC.EXE
    for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
    set RDATE=%datetime:~0,4%-%datetime:~4,2%-%datetime:~6,2% 
    

提交回复
热议问题