win10 home version cmd running gpedit.msc can't find the file? | Set up a batch script to run automatically at startup

question

Recently, the win10 home version notebook wants to set the boot to start automatically, and running gpedit.msc directly prompts that there is no gpedit.msc (group policy)

Scenes

win10 Home Edition set boot automatically run batch script

reason

Win10 Home Edition does not provide the Group Policy Editor function. But it is not to say that there is no such function, but that this function is restricted, just enable it.

solution

1. Open Notepad, enter the following content, and save the file ending with bat, for examplegpedit.bat

@echo off
    pushd "%~dp0"
    dir /b %systemroot%\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >gp.txt
    dir /b  %systemroot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>gp.txt
    for /f %%i in ('findstr /i . gp.txt 2^>nul') do dism /online /norestart /add-package:"%systemroot%\servicing\Packages\%%i"
    pause

Precautions for online viewing:
When saving the TXT file, pay attention to the text encoding rule as UTF-8, otherwise the bat right-click administrator will crash

2. Run the file

Right-click on gpedit.bat and select "Run as administrator". Note that batch dism commands require administrator privileges, so batch processing must be run as an administrator.

Batch execution

After completing the above operations, press the WIN+R key to open and run the input gpedit.msc, press the Enter key or the OK button to open the group policy

After opening the group policy, set the batch script to start automatically after booting. Supplements are as follows

How to set up a batch script to run automatically at startup under windows

Create a text file, click Save As under the file, and save the file ending with bat

1. WIN+R key to open the operation input gpedit.msc, press the Enter key or the OK button to open the group policy

2. Click Windows Settings ==> Script (Startup/Shutdown), then double-click to start

Add the selected batch script that was originally edited

It is mainly used in some environmental software to boot automatically (such as Nginx, etc.)

Several ways to start the follow-up supplementary program

  • Set up to automatically run batch scripts at startup (already completed)

  • Add exe program shortcut to start menu

  • Add program to system services

  • Under Computer Management, under Task Scheduler Library, click Create Basic Task

Refer to several ways for the program to start automatically

Guess you like

Origin blog.csdn.net/qq_44138925/article/details/128843159