Windows Powershell输出不为';从任务计划程序调用时,不能正确记录
我需要记录我的powershell输出。我的ps文件如下所示:Windows Powershell输出不为';从任务计划程序调用时,不能正确记录,windows,powershell,azure,scheduled-tasks,taskscheduler,Windows,Powershell,Azure,Scheduled Tasks,Taskscheduler,我需要记录我的powershell输出。我的ps文件如下所示: #Set-ExecutionPolicy Unrestricted $ErrorActionPreference="SilentlyContinue" Stop-Transcript | out-null $ErrorActionPreference = "Continue" $date = (Get-Date).tostring("MMddyy HHmmss") $filename = 'C:\apierror\logs\' +
#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运行它时,只有控制台输出的一部分存储在文件中
知道为什么吗?出于某种原因,使用转录本只存储了部分输出。与powershell相反,我最终将日志直接使用到python文件中。似乎工作正常