I followed this tutorial for scheduling a task for running a script using node:
https://eddyerburgh.me/run-a-node-script-with-windows-task-scheduler
I left my pc turned on so it could execute the script, but when i came to see if it did execute, there was only a cmd.exe instance open and the task didn't execute the script.
Here's how i configured the action:
Program/Script - C:\WINDOWS\system32\cmd.exe
Arguments - --a -i -c "cd C:\Users\xxxxx\Desktop\folder; node script.js"
Is there another way of doing this?
I've managed to make it work by making a .bat file like this:
if not "%minimized%"=="" goto :minimized
set minimized=true
@echo off
cd "<folder where the script is">
start /min cmd /C "node <the script you want to execute>"
goto :EOF
:minimized
Then you can schedule the .bat file to be executed.
You don't need all those extra arguments. Just use the following settings:
Program/Script: node
(or "C:\\Proram Files\node\node.exe"
if it's not in your PATH)
Arguments: C:\\Users\user\folder\script.js
It will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With