简体   繁体   English

如何在计划任务中使用System.Configuration.Install.Installer?

[英]How to use System.Configuration.Install.Installer with scheduled tasks?

The subclasses of System.Configuration.Install.Installer are useful in combination with InstallUtil.exe because of the transactional behavior and easy uninstallation. 由于事务行为和易于卸载,因此System.Configuration.Install.Installer的子类与InstallUtil.exe结合使用非常有用。

My particular app needs create a scheduled task (Windows Task Scheduler) when installed, and delete this scheduled task when uninstalled. 我的特定应用程序需要在安装时创建计划任务 (Windows Task Scheduler),并在卸载时删除此计划任务。 I see there is a ServiceInstaller for services, but is there something equivalent for scheduled tasks? 我看到有用于服务的ServiceInstaller ,但是否有与计划任务等效的东西? or what is the suggested approach for creating/deleting tasks as part of (un)installation? 或在(取消)安装过程中创建/删除任务的建议方法是什么?

You can write a script file that calls schtasks.exe 您可以编写一个调用schtasks.exe的脚本文件。

To install a task 安装任务

schtasks /Create ...

To uninstall a task 卸载任务

schtasks /Delete ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.Configuration.Install.Installer实例如何获取目标文件夹? - How a System.Configuration.Install.Installer instance can get the destination folder? 如何使System.Configuration.Install.Installer从安装项目中获取变量? - How to make a System.Configuration.Install.Installer to get a variable from the Setup project? 如何在果园中运行预定任务? - How to run scheduled tasks in Orchard? 如何查看当前用户的计划任务列表 - How to view a list of Scheduled Tasks for current user 通过installutil安装长期运行的服务时如何将参数传递给Configuration.Install.Installer - How to pass arguments to `Configuration.Install.Installer` when installing a long-running service through `installutil` 如何在C#中列出计划任务 - How to list scheduled tasks in C# 如何使用.NET 2 System.Configuration.Install检测更新? - How to detect an update using .NET 2 System.Configuration.Install? 如何在.NET Framework 3.5上使用System.Threading.Tasks类 - How to use the System.Threading.Tasks Class on .NET Framework 3.5 如何在F#中使用System.Threading.Tasks? - How to use System.Threading.Tasks in F#? C# - 如何使用TaskSchedular类列出特定用户的计划任务 - C# - How to list Scheduled Tasks for a specific user with the TaskSchedular Class
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM