简体   繁体   中英

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.

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.

Commands with nodejs: https://stackabuse.com/executing-shell-commands-with-node-js/

schtasks command: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks

I am unsure about turn on PC part.

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.

In the.Net world you could also host a HangFire web site or something like it. To expose API endpoints for your application to fire off jobs or series of jobs. https://www.hangfire.io/

Or: You should be able to call a PowerShell script. *** Addison Schmidt answer it likely much more direct. Depending on your needs.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM