简体   繁体   English

你能在 Windows 任务计划程序中从 react 本机桌面应用程序(或任何其他 js 框架)创建任务吗

[英]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.

相关问题 除了 react-native-background-task 之外,还有什么方法可以在 React Native 中执行后台任务吗? - Is there any way to do background tasks in React Native other than react-native-background-task? 使用 python 创建一个电子 JS 桌面应用程序并响应 js - Create an electron JS desktop app with python and react js React Native:如何将 props 变量从其他 js 文件传递到 app.js 文件 - React Native: How to pass a props variable from other js file to app.js file 当用户从 web 应用程序进行任何更改时,我如何通知本机应用程序进行更改 - How can i notify react native app for the changes, when any changes is made by user from web app 一个咕噜咕噜的任务可以运行其他grunt任务吗? - Can a grunt task run other grunt tasks? 您如何在 React Native 中的任何导航事件上调用 function? - How can you call a function on any navigation event in React Native? 使用React Native运行繁重的JS任务 - Running Heavy JS Tasks w/React Native 有什么方法可以在React Native应用中使用p5.js吗? - Is there any way to use p5.js in react native app? 你能用just react、node js和mongoose来创建一个聊天应用吗? 是否需要socket.io? - Can you use just react, node js and mongoose to create a chat app? Will there be a need for socket.io? 在create-react-native-app上的Knex.js - Knex.js on create-react-native-app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM