Run any Dart Script as a Windows Service with AlwaysUp

How to Run any Stand-Alone Dart Script as a Windows Service with AlwaysUp

Start your application with the Dart VM (dart.exe) in the background when your PC boots, before you log in. Keep it running 24/7 or schedule it to restart several times a day

Google's Dart programming language was launched in 2011 as a more structured, better-performing alternative to JavaScript. Dart is often used to build web applications that run in a browser but it also supports the construction of stand-alone applications.

To run your Dart script as a background windows service with AlwaysUp:

  1. Download and install AlwaysUp, if necessary.

  2. If you don't have Dart installed, download the Dart zip file and extract it to a folder of your choice.

    We have placed Dart in C:\dart and we'll reference that location throughout this tutorial.

  3. Next, let's ensure that your Dart script can run normally from the command line.

    1. Start a command prompt (Start button > Run > cmd.exe)

    2. In the window that appears, type the full path to the Dart executable (dart.exe) followed by the full path to the script you wish to run as a windows service. Be sure to quote each component containing at least one space!

      Since we have placed Dart in C:\dart, and our script is C:\dart\sample-dart-script.dart, our command line is:

      C:\dart\dart-sdk\bin\dart.exe C:\dart\sample-dart-script.dart

    3. Hit the Enter key to execute the command line. If your script doesn't work as expected please resolve the issues now. If your script doesn't run here then it won't run as a windows service with AlwaysUp!

      Here's the code of our simple script:

      Sample Dart script code

      And here is the result from running it on the command line:

      Sample Dart script code running

      Everything looks good!

  4. Next, start AlwaysUp.

  5. Select Application > Add to open the Add Application window:

    Add Application

  6. On the General tab:

    • In the Application field, enter the full path to the Dart executable (dart.exe). Again, as in step 3b, this is C:\dart\dart-sdk\bin\dart.exe for our installation.

    • In the Arguments field, enter the full path to your Dart script. We want to run our sample script, C:\dart\sample-dart-script.dart.

    • In the Name field, enter the name that you will call this application in AlwaysUp. We have used My Dart Script but you can specify virtually anything you like.

    Dart Script Windows Service: General Tab

  7. If you want your script to run periodically (that is, not 24/7), click over to the Restart tab and choose when to run. For example, if you wish to kick off the script at 9 AM every day, check the Not immediately and At boxes and enter that time in the corresponding field. However we'll stick with the default of restarting immediately to keep our Dart script running all the time.

    Dart Script Windows Service: Restart Tab

  8. Click the Save button. In a couple of seconds, an application called My Dart Script will show up in the AlwaysUp window. It is not yet running though (the state will be Stopped).

    Dart Script Windows Service: Created

  9. To start the service, which will kick off the Dart script, choose Application > Start "My Dart Script". In a few seconds, the state should transition to Running and clicking on the green circle will reveal a few details of the running process.

    Dart Script Windows Service: Running

    On Windows 8/7/Vista and Server 2012/2008, your Dart script will be running in the background on the isolated Session 0. Select Tools > Switch to Session 0 to move to Session 0 where you should see a CMD window hosting your script:

    Dart Script Windows Service: Running in Session 0

    If you wish to hide that command window (and prevent the annoying notifications from the "Interactive Services Detection" window), edit your application in AlwaysUp, switch over to the Logon tab and check the When a user logs on, don't show the application's windows... box at the bottom.

  10. That's it! Next time your computer boots, your Dart application be launched immediately, before anyone logs on. We encourage you to explore the many other AlwaysUp settings that may be appropriate for your environment. For example, boost priority, run periodically and much more.



Dart script not working properly as a Windows Service?

  • From AlwaysUp, select Application > Report Activity > Today... to bring up a HTML report detailing the interaction between AlwaysUp and your application. The AlwaysUp Event Log Messages page explains the more obscure messages.
  • Some Dart scripts need to be run in a user account to have access to their settings and resources. In that situation, edit your application in AlwaysUp, switch to the Logon tab and enter the user name and password of the account where you can run your Dart script normally (the one you were logged in to for step 3).
  • Consult the AlwaysUp FAQ for answers to commonly asked questions and troubleshooting tips.
  • Contact us and we will be happy to help!

Download & Try it Free!

Download AlwaysUp and Run as a Service Today! Version 15.1 New!

7.9 MB Installer
Our 12,000+ customers include...
Compatible with Windows 11 Compatible with Windows Server 2022 Compatible with Windows 10
Over 94,000 installations, and counting!
 
AlwaysUp is number 1! Run as a Service with AlwaysUp

Rock-solid for the past 19+ years!