I am struggling with this since yesterday, i have created a Batch file -a simple one- which simply will try to read the logs of a windows scheduled task and based on searching for correct 'Last result' will log 0 or 1 to a log file . The Batch file run perfectly . But i want to schedule this Batch file to be ran each 2 minutes ,
so i create a scheduled task that ran this batch file ;When i force starting the scheduled task, I don't see any errors in the task scheduler history, but at the same time my Batch file is not executed.
What i tried, -i made sure i am running the scheduled task with option "run with highest privileges" , -i made sure i have correct permissions (still not sure) I tried using process monitor and didn't see any access issues so nothing happens when i run my task i am going crazy,
This is the content of my Batch file :
SET LOGFILE=MyLogFile.log
call :Logit >> %LOGFILE%
exit /b 0
:Logit
:: The rest of your code
:: ....
for %%A in (DownloadToIngest.log) do set fileSize=%%~zA
echo %fileSize%>logall.log
if %fileSize% GTR 419430400 (break>DownloadToIngest.log)
schtasks /QUERY /FO LIST /V /tn DownloadToIngest> DownloadToIngestOutput.log
findstr /m "Last Result: 0" DownloadToIngestOutput.log
IF %errorlevel%==0 (>>DownloadToIngest.log echo 1) ELSE >>DownloadToIngest.log echo 0<code>
感谢Vector(请看Vector的评论),此问题已通过以下方法解决:而不是引用“ Program / script”下的路径和文件名,而是在“ Program / script”下添加脚本的名称以及在“ Start in(可选的)'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.