Introduction
Every desktop operating system allows its users to run scripts. On Windows 10, you can run a batch script, a PowerShell script, an AHK script, a VBS script, and more. One script type you can’t run out of the box is a Shell script. A Shell script is written and used on Linux systems. Running PowerShell Startup (Logon) Scripts Using GPO Group Policy allows you to run various script files at a computer startup/shutdown or during user logon/logout. You can use GPOs not only to run classic batch files on a domain computers (.bat.cmd.vbs), but also to execute PowerShell scripts (.ps1) during Startup/Shutdown/Logon/Logoff.
You can specify what programs you want to run on Windows boot.All you have to do is add the script, executable, or shortcut in tothe startup folder. Alternatively you can use scheduled tasks tomanage startup scripts. This will show you how to use both methods.
One such capability is its use of an obfuscated batch script launcher to jumpstart malicious executables. The fact that batch scripts need no interpreter but Microsoft Windows' inbuilt command. In its simplest form, a batch file (or batch script) is a list of several commands that are executed when you double-click the file. Batch files go all the way back to DOS, but still work on modern versions of Windows. Using startup folder to launch scripts. The easiest way to trigger scripts to run at startup is to drop then inside the startup folder. To easily navigate to the startup folder, Windows has an alias available: shell:startup.
Using startup folder to launch scripts
The easiest way to trigger scripts to run at startup is to dropthen inside the startup folder.
To easily navigate to the startup folder, Windows has an aliasavailable: shell:startup
. Use shell:common startup
You can get to the startup folder a couple ways:
- Open the Run dialog with
WindowsKey+R
and entershell:startup
. - In the command prompt, enter
explorer shell:startup
.
Simply copy your files that you want run on startup in to the folder.
For example, in Windows 10, these paths work for me for user and global:
Enable and disable startup apps
Many apps run on startup that do not have any files in the startup folder.You can manage the startup apps from the Task Manager | Startup
tab orby running taskmgr.exe
.
In addition you can disable scripts from your startup folder so you don't haveto remove them to disable them.Right click on an item to enable or disable it.
Using scheduled tasks
An alternative to the startup folder is scheduled tasks.You can schedule a task to run on startup.
For a GUI, run taskschd.msc
to create, delete, enable, disable, and otherwise manageall scheduled tasks.
To manage scheduled tasks from the command prompt, use schtasks.exe
.This program will allow you to create, delete, and runscheduled tasks. You can get help about the commandsby running one of the following:
Remember to run an administrator command prompt for these commands.Example for creating a script to launch on startup as local user on login:
Script Windows Sandbox
You can tell a script to run as system on start like this:
Script Windows 10 Feature Update
Conclusion
After this, you should understand how easy it is to launch yourown programs on startup.
Script Windows Update Reset
If you want to run a long-running or background service, considersetting up a Windows service so you can manage it with services.msc
.