DEV Community

lia
lia

Posted on • Updated on

How to schedule any file type to open at computer startup

So, how about schedule certain programs or files to open first thing when your computer boots up? Or maybe you want them to open at a specific time of the day?

Maybe you work remotely and need certain programs, folders or files to open when you start your computer while you can do your morning routine. If so, then this post will feature a program which will (hopefully) help you with that!

That was my problem! I did not like having to use Windows startup feature because it did not let me open programs at specific days. Even the Windows Task Scheduler was not simple enough and did not let me schedule programs at certain days and at startup in the same configuration. I hated having to close all my work programs manually on weekends.

So, I developed a command line interface (CLI) to do that exact task: schedule programs, folders or files (anything really) at startup but also at specific days.

Now, I'm a changed person and can finally have my work programs open at startup only on week days and forget about work completely (without reminders) on weekends.


Installing

You will need Python installed. You can do that here.

The CLI can be downloaded from here and the GitHub repository can be found here.

pip install progscheduler
Enter fullscreen mode Exit fullscreen mode

To check if the program was successfully installed, you can run the following command in the console:

progscheduler -h
Enter fullscreen mode Exit fullscreen mode

How to

For anymore information please have a look at this file.

Startup feature

Windows users

This program does not actually have the ability to start running automatically by itself when the computer boots up yet, so you have to copy the contents of this file right here (available on the GitHub repository) and paste them to a notepad on your computer. Don't forget to save the file with the .bat extension.
The purpose of the file is run the progscheduler program. So this needs to be in the following folder path:

C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Enter fullscreen mode Exit fullscreen mode

What this step does is to make Windows run all the files in this folder when it boots up (at startup).

Linux users

I don't own a Linux environment so this section will have to wait until I make sure I know how to explain this.


After this step, you should be able to boot up your computer and the program will run automatically.

Usage

For now, when the computer boots up, the program will not do anything. This is because we did not schedule anything yet.
To do this, you need to open a command prompt to start using the CLI.

Commands

When configuring you will need the following information about a program, folder or file:

  • path to program, folder or file;
  • desired name to describe this program, folder or file;
  • days to open;
  • time of the day to open; ##### Path The path can be the absolute path of an executable, a folder, a file, etc. If it's a program or a file, the path must include the extension.

IMPORTANT
If you want an executable to be schedule, some programs will not work with the original file path and it needs to be the path for a shortcut of that executable.
To use a shortcut, the extension of that file must be .lnk.

For instance, a path for a shortcut executable:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk
Enter fullscreen mode Exit fullscreen mode

or a path for a folder:

C:\Users\<username>\Desktop\folder to open
Enter fullscreen mode Exit fullscreen mode

or a path for a file,

C:\Users\<username>\Desktop\text file to open.txt
Enter fullscreen mode Exit fullscreen mode

Alias

The alias is a name which will describe the file to be scheduled and it will be used for update the scheduling if needed in the future.

Days

The days will be the days in which you want something to be opened. It can be:

  • some specific days: monday, wednesday
  • everyday: monday, tuesday, wednesday, thursday, friday, saturday, sunday
  • weekdays: monday, tuesday, wednesday, thursday, friday
  • weekends: saturday, sunday

Time

The time can be at startup, in this case you don't have to specify anything because this is the default. Can also be a specific time of the day: 10:27.


The commands are available in the README.md file in the GitHub repository.

Create/Configure a schedule

If you want to schedule Paint to open only at week days at startup then the following command should work:

progscheduler -a paint -e "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk" -d weekdays
Enter fullscreen mode Exit fullscreen mode

create schedule at startup

On the other hand, if you want to schedule Paint to open only on weekends and at 15:05, the following command should also work:

progscheduler -a paint -e "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk" -d weekends -t "15:05"
Enter fullscreen mode Exit fullscreen mode

create schedule with specific time

Now, if you want to change Paint to open only on Mondays at startup then:

progscheduler -a paint -d monday -t "at startup"
Enter fullscreen mode Exit fullscreen mode

configuration of a schedule

Note the alias is required when creating or modifying a schedule. An alias needs to be unique, because if not, it can configure the wrong configuration or create a non-sense configuration.

Scheduling in action

After we added a schedule and the next time the computer boots up, the program will run automatically and Paint will be opened.
The following image shows that a command prompt will be opened at startup and start running all schedules created.

scheduling in action

If a specific time has been set, then the image does not change much, it will be running and when the specified time comes, the program will be opened and showed and this command prompt.

Upon closing this command prompt window, the program will not run anymore schedules so only close it when you know there's no files to be opened.
If closed, the next time the program will start running is:

  • if the computer boots up;
  • if you run manually the program-scheduler.bat;
  • if you run the command 'progscheduler' in a command prompt.

Other features

Delete a configuration

A configuration can also be deleted by the alias by simply typing in the command prompt:

progscheduler -del paint
Enter fullscreen mode Exit fullscreen mode

Future features

Currently the program only opens any type of file, in the future, other options can be added by user request.


Conclusion

I'm fully available to implement new features, fixing bugs and improve anything. Just comment here or open an issue in the GitHub repository.
Any suggestions I'm more than glad to consider them.
Any feedback is really appreciated.

For anymore information please have a look at this file.

The CLI can be downloaded from here and the GitHub repository can be found here.


Thanks for reading :D

Oldest comments (0)