Batch file 通过批处理运行python脚本的日志记录

Batch file 通过批处理运行python脚本的日志记录,batch-file,Batch File,我有一个名为“AI_V.0.0.1_G.1.py”的python脚本 就在脚本开始时,我用时间定义了当前时间,所以我这样做了: set currenttime=%time% 如果我只是跑: AI_V.0.0.0.1_G.1.py 然后它就完美无缺了。问题是我需要记录它。当我运行此命令时: AI_V.0.0.0.1_G.1.py>>%currenttime%.log 然后说是 The system cannot find the path specified. 有什么帮助吗?试

我有一个名为“AI_V.0.0.1_G.1.py”的python脚本

就在脚本开始时,我用时间定义了当前时间,所以我这样做了:

set currenttime=%time%
如果我只是跑:

AI_V.0.0.0.1_G.1.py
然后它就完美无缺了。问题是我需要记录它。当我运行此命令时:

AI_V.0.0.0.1_G.1.py>>%currenttime%.log
然后说是

The system cannot find the path specified.

有什么帮助吗?

试试这个,它使用
%time%
并将
替换为
-

e、 g.
18-04-54.22.日志

AI_V.0.0.0.1_G.1.py>>%time::=-%.log

echo%currenttime%
对我没有任何帮助,但
echo%time%
对我有帮助。问题是,它包含的
在路径中不是有效字符,除了驱动器号。@AjVJsy抱歉,我编辑了它。谢谢,我发现我根本无法记录它,因为它在运行时不会显示在脚本的输出中。但这确实让它起作用了。