【发布时间】:2016-04-28 20:31:58
【问题描述】:
我需要记录我的 powershell 输出。我的 ps 文件是这样的:
#Set-ExecutionPolicy Unrestricted
$ErrorActionPreference="SilentlyContinue"
Stop-Transcript | out-null
$ErrorActionPreference = "Continue"
$date = (Get-Date).tostring("MMddyy HHmmss")
$filename = 'C:\apierror\logs\' + $date + '.txt'
Start-Transcript -path $filename -append
$python = "C:\Python34\python.exe"
$python_path = "C:\script.py"
cd (split-path $python_path)
& $python $python_path
Stop-Transcript
现在,当我直接从 powershell 运行此文件时,输出已正确记录。但是当我尝试从 taskscheduler 运行它时 - 只有一部分控制台输出存储在文件中。
有什么想法吗?
【问题讨论】:
标签: windows powershell azure scheduled-tasks taskscheduler