Windows: how to run node command on Task Schedule


Step 1: Find localtion of file powershell.exe

C:\Users\Administrator>where powershell.exe
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Step 2: goto Task Schedule -> Create Basic Task

windows-how-to-run-node-command-on-task-schedule-step-2

Step 3: fill fields Name and Description then click Next

windows-how-to-run-node-command-on-task-schedule-step-3

Step 4: choose a Trigger , for example i choose daily, then click Next

windows-how-to-run-node-command-on-task-schedule-step-4

Some settings:

windows-how-to-run-node-command-on-task-schedule-step-4b

Step 5: choose Start a grogram then click Next

windows-how-to-run-node-command-on-task-schedule-step-5

Step 6:
Paste the path found in Step 1
Arguments: "Push-Location -Path C:/Path/to/your/js/file;Start-Process node.exe index.js -WindowStyle Hidden"

windows-how-to-run-node-command-on-task-schedule-step-6

Step 7: finish

windows-how-to-run-node-command-on-task-schedule-step-7

Leave a Reply