In Windows, the startup program does not rely on Account Login, and does not rely on accounts

Source: Internet
Author: User

In Windows, the startup program does not rely on Account Login, and does not rely on accounts

In Windows, we want to run many tasks automatically after Windows is started. For example, the company has a meal ordering system, which basically needs to log on to order meals every day, so it writes a script to implement automatic meal ordering. However, your computer needs to be shut down every day. Of course, you do not need to manually run the rice ordering script after it is started. At this point, we need to implement this script as the Automatic startup script.
Note that the startup program described in this article is enabled when the user has not logged on. In other words, the startup program described in this article is running in Session 0.This article mainly introduces the method in step 3. You can select the appropriate method for implementation.

Windows Service

When Windows is started and you have not logged on to the account, the Service set to auto in Windows will run in Session 0. Follow these steps to implement Windows Service:
1. If you have not implemented the Windows Service program, you can refer to this article Simple Windows Service in C ++.
2. Use the command line to create a Service.start= autoSet Service to start at startup.

sc create “SERVICE_NAME” binpath= "SERVICE_PROGRAM" displayname= "SERVICE_DESCRIPTION" start= auto
Windows Startup Script

Follow these steps:
1. Open the local group policy management and run the commandgpedit
2. Then openComputer Configuration->Windows Settings->Scripts->StartupIn Startup, configure the script or program to be started.
We want to automate the configurations on the machine as much as possible, so we want to do this through the script. Unfortunately, without the CMD command, you can directly use this method to add the Startup Program. Then, the blogger searches for some methods, either by directly modifying the registry or by using the vb script, however, these methods are not straightforward and simple.
As a result, the blogger finds the method to be discussed next, and uses the Windows scheduled task manager.

Windows Schedule Task

Windows scheduled task manager provides powerful functions: it can execute tasks on a scheduled basis, except for triggering scheduled tasks by time,It also provides the function of triggering program running upon startup.You can configure it through the graphical interface or by using the command:

  • Open in sequenceControl Panel->Administrative Tools->Task SchedulerAnd then create your own task. Pay attention to the following two points:
    • Select "System" as the account for running the task"
    • Trigger, selectAt StartupTrigger
  • Use the following command line:
schtasks /create /TN "TASK_NAME" /RU SYSTEM /SC ONSTART /TR "TASK_PROGRAM"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.