我如何找到启动我的进程的计划任务的 instanceid/correlation ID [英] how can i find the instanceid/correlation ID of the scheduled Task that started my process

查看:40
本文介绍了我如何找到启动我的进程的计划任务的 instanceid/correlation ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个运行我的 EXE 的 Windows 计划任务.有没有办法从我的 EXE 内部找到触发我的计划任务实例?

if i have a windows scheduled task that runs my EXE. is there a way from inside my EXE to find the scheduled task instance that triggered me?

推荐答案

对此的简单回答是:否.

Easy answer for that would be: no.

您能做的最好的事情是以编程方式访问任务调度程序库并查看您所在的进程是否处于运行"模式,获取进程的 PID(调度程序实际上将其写在其历史记录中)并将其与你的.

Best thing you could do is programatically access either the task scheduler library and see whether the process you are is in "running" mode, get the PID of the process (scheduler actually writes it out in its history) and compare it to yours.

更简单的方法是访问系统事件日志并查看是否有任何提及执行您的 exe 文件(尽管如果实际执行了 exe,它们可能不是这样的日志).

Easier thing to do would be accessing to system event logs and seeing if there's any mention of execution your exe file (though they may not be such a log if the exe was actually executed).

您唯一可以与您的流程相关联的是调用方(可能是网络服务或某些预定义的帐户),它不会提供有关正在调度的任何信息.

The only thing you can associate with your process is the caller (which might be NETWORK SERVICE or some predefined account) which do not give any information regarding it being scheduled.

这篇关于我如何找到启动我的进程的计划任务的 instanceid/correlation ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆