To perform certain customized functions, scripts can be run when Windows Operating System starts or shuts down. The method to execute a script at startup or shutdown varies with different versions. Here's how to execute scripts at shutdown and startup.
Note: This trick works in Windows XP, Vista and Windows 7 and recent versions, but the method varies depending on your edition.
For professional or full editions
- Start the policy editor of the local group: Start Menu > Run > Type gpedit.msc
- Under Vista or Windows 10 you can type the command in the search bar of the start menu or press Windows key + R
- Go to Computer Configuration > Windows Settings > Scripts (Startup/Shutdown)
- Depending on what you want, double click on Start or Stop system
- Click Add > Browse and select the script you want to add.
For all editions
These steps involve modifying the registry. It is therefore recommended to make a backup before proceeding.
- Open notepad and copy the code below:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Startup] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Startup\0] "GPO-ID"="LocalGPO" "SOM-ID"="Local" "FileSysPath"="C:\\Windows\\System32\\GroupPolicy\\Machine" "DisplayName"="Stratégie de groupe locale" "GPOName"="Stratégie de groupe locale" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0] "GPO-ID"="LocalGPO" "SOM-ID"="Local" "FileSysPath"="C:\\Windows\\System32\\GroupPolicy\\Machine" "DisplayName"="Stratégie de groupe locale" "GPOName"="Stratégie de groupe locale" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Startup\0\0] "Script"="C:\\script1.bat" "Parameters"="" "ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Once you understand the code, you can adapt it to suit your needs by changing some of the variables.
- C:\\script.bat represents the path to your script on the hard disk.
- 0 represents the number of the script in case you have several scripts to run.
- Startup is the time of execution of the script.
It is possible to add multiple scripts:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Startup\0\0] "Script"="C:\\script1.bat" "Parameters"="" "ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
It is also possible to specify parameters for the execution of this script by changing the Parameters field.
Finally, save this text file:
- Go to File > Save.
- Give it a name ending with .reg.
- Select All files in the list box File Type.
- Save the file to the desired location and double click on this file.
Windows
- Windows startup script
- Run script at shutdown windows 10
- Startup script windows 10
- Windows startup sound changer > Télécharger
- Copy files from one server to another windows batch script [solved] > Forum - Windows
- Teamviewer start with Windows: missing, registry > Guide
- Execute a script on Ubuntu: at startup, shutdown > Guide
- Cyberlink Power DVD 11 - Launch at Windows startup
- How to save ping report in text file?
- Fix the Windows security bug: Print Nightmare
- Clear RAM on Windows: via cmd, shortcut, without rebooting
- Turn off automatic updates on Windows: 7, 8, and 10
- Microsoft Windows 11: release date, download, beta, update
- Install apps on Windows 10: via Run, without Microsoft store
- Disable password at login: On Windows 7/8.1/10
- How to enable the screen reader: on Windows 7, 8.1, and 10
- Enable/Disable device via command line
- How to check power usage on Windows PC?
- Network PC asking for username and password: Windows 10
- How to open MSI file: on Mac, in Android, in Windows 10
- Stop CMD from closing: automatically, after running program
- How to create an icon in Paint
- Java update tab missing: Windows 10
- Fix disk boot failure: Windows XP, 7, 8, 10
- Set up your MagicJack: On Windows 10, 8, 7, Vista, XP
- Enable or disable the welcome screen: Windows 7, 8, 10, 11
- Corrupted driver: Code 39, Windows 10,
- Disable right click: Windows 10, Windows 11
- How to use TV as second monitor: with HDMI, Windows 10
- Command prompt: Windows 10, commands, shortcut
- Stay online when switching user account: Windows
- Exe files not opening: Windows 7, Windows 10, Vista, XP
- Most common Windows error codes and how to fix them
- Computer error codes list and solutions
- Start/Stop a Service on Windows: command line, 10
- Removing the files remaining after uninstalling a program
- How to check software installed date in Windows
- Restart Windows without restarting computer: Windows 10
- How to disable network sharing on Windows Media Player?
- How to enable/disable administrator account in Windows?
- How to know if you need more RAM on Windows 10?
- ipconfig command: in Windows, not found
- How to rip copy protected CD: Windows Media Player
- How to eject USB flash drive with a keyboard shortcut?
- How to create an Autorun.inf file: in Windows 7
- How to enable touchpad: Windows 10, on laptop
- Reset PC to factory settings: Windows 11, 10, 8.1
- Restore a Windows PC to factory settings without disc
- How to rotate multiple images: at once, Windows 10
- Disable print spooler: on Windows 7, 10, 11
- .exe is Not a Valid Win32 Application: fix Windows 7, XP
- Windows volume icon: not working, not showing
- How to change account name in Windows 8.1
- Recover deleted music files in Windows Media Player
- How to fix Limited or No Connectivity issues on Windows?
- How to stop my Windows background from changing?
- Delete file in Windows: CMD, 10
- Start Windows computer in safe mode: via cmd, settings
- How to verify Windows license
- Disable print spooler service: in domaine controllers
- Enable automatic sign-in: on Windows 10, 8, 7
- Customize the mouse pointer in Windows 8, 10
- How to disable network access to Windows registry?
- Disable touchpad: when mouse is connected, Windows 10
- Disable Deepfreeze: from Command Prompt, without password
- Add a printer in Windows 8.1, 10
- Md5sum download and how to use
- How to turn off the camera on Windows
- How to fix a blue screen on Windows
- Desktop icons missing Windows: 10, 7, after update
- How to uninstall apps on Microsoft Surface
- How to disable or enable the Encrypting File System: Windows
- Disable the Touchpad when mouse is connected: Windows 11, 10
- How to change desktop icons in Windows
- Kernel Stack Inpage Error on Windows: how to fix?
- How to open the Control Panel: Windows 11, 10, 8.1, 7
- How to share files between two Windows PCs?
- Improve your PC performance: for gaming, without formatting
- Change computer system language: Windows 7, Windows 10
- How to check the Windows version: Windows 11, 10, 8.1, 7
- Best apps to update your Windows drivers
- Unable to install .NET Framework Error Message 0xc8000222
- Enable admin account in Windows 7, 8, 10
- Windows task manager missing menus and tabs
- How to backup Windows data: with .bat
- How to fix HDMI audio from laptop to TV: Windows 11,10,8,7
- HAL is missing in Windows
- Windows CLIP command
- How to create desktop shortcuts: Windows 11,10,8,7
- How to change the default OS in dual boot: Windows 11,10,8,7
- Disc boot failure Windows
- How to add the Run command to Start menu: Windows 11,10,8.1
- MSOCache delete
- Safely Remove Hardware icon missing in Windows
- How to check laptop battery health: windows 8, 10
- How to set Command Prompt size: Windows 11, 10, 8.1, 8, 7
- How to turn off airplane mode: Windows 11,10,8.1,8
- How to clear recent files: Windows 11,10,8.1
- USB hard drive not showing up: Windows
- How to reduce data usage: Windows 11, 10
- How to show the preview pane: Windows 11, 10, 8, 7
- How to fix sound problems: Windows 11, 10, 8.1, 7
- How to disable or enable Autoplay: Windows 11, 10, 8.1, 7
- How to turn off Firewall: Windows 11, 10, 8.1, 8, 7
- How to show desktop icons in Windows 10
- How to change the date and time: Windows 11, 10, 8.1, 7
- Your security settings do not allow this file to be dowloaded
- How to stop automatic restart: Windows 11, 10, 8, 7, XP