[英]Can you create tasks in the Windows Task Scheduler from a react native desktop app (or any other js framework)
I am trying to find a way to create a desktop application where I can setup Tasks to run that will turn on my pc and run a c# app / shell script that will send an api request with a video file and a text file.我正在尝试找到一种创建桌面应用程序的方法,我可以在其中设置要运行的任务,该任务将打开我的电脑并运行 c# 应用程序 / shell 脚本,该脚本将发送一个 Z8A5DA52ED126447D359E70C05721 和一个文本文件请求。
If you use nodejs, you can execute commands in the terminal with the exec function from the child_process module, then use the schtasks
command to schedule tasks.如果你使用 nodejs,你可以在终端中使用 child_process 模块中的 exec function 执行命令,然后使用schtasks
命令来调度任务。
Commands with nodejs: https://stackabuse.com/executing-shell-commands-with-node-js/使用 nodejs 的命令: https://stackabuse.com/executing-shell-commands-with-node-js/
schtasks command: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks schtasks 命令: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks
I am unsure about turn on PC part.我不确定打开 PC 部分。
You could write a Windows Service worker that runs in the backend, then interact with it vai a local datasource (like a Database or Text file) from your react native desktop app.您可以编写在后端运行的 Windows Service Worker,然后通过本地数据源(如数据库或文本文件)从您的 react 本机桌面应用程序与其交互。
In the.Net world you could also host a HangFire web site or something like it.在.Net 世界中,您还可以托管 HangFire web 站点或类似站点。 To expose API endpoints for your application to fire off jobs or series of jobs.为您的应用程序公开 API 端点以触发作业或一系列作业。 https://www.hangfire.io/ https://www.hangfire.io/
Or: You should be able to call a PowerShell script.或者:您应该能够调用 PowerShell 脚本。 *** Addison Schmidt answer it likely much more direct. *** Addison Schmidt 的回答可能更直接。 Depending on your needs.取决于你的需要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.