Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows Powershell输出不为';从任务计划程序调用时,不能正确记录_Windows_Powershell_Azure_Scheduled Tasks_Taskscheduler - Fatal编程技术网

Windows Powershell输出不为';从任务计划程序调用时,不能正确记录

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\' +

我需要记录我的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运行它时,只有控制台输出的一部分存储在文件中


知道为什么吗?

出于某种原因,使用转录本只存储了部分输出。与powershell相反,我最终将日志直接使用到python文件中。似乎工作正常