the auto exec page
Posted: 2023-Jun-28, 7:11 pm
Just saw the new autoexec page -> https://ss64.com/nt/syntax-autoexec.html
There are few things that eventually can be added. The registry keys that can start a program at the start are (here's the doc https://learn.microsoft.com/en-us/windo ... istry-keys):
on machine level:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
for the current user:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
All of them are managed by RunOnce.exe. The RunOnce keys are more interesting as the RunOnce.exe deletes the values from the registry once the program is ran. The more interesting thing in RunOnce keys is that you can run them in safe mode!!
The command should be prefixed with asterix.
To prevent deletion you can use exclamation (I don't know if the asterix and exclamation can be combined). For all of them limit is 260 chars.
There are also two start up folders - one for the current user and one for the whole machine:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
And with task scheduler - the command line gives more control (though this is covered in the SCHTASKS page):
SCHTASKS /Create /SC ONEVENT /MO ONLOGON /TN ON_LOGON /tr "c:\some.bat"
SCHTASKS /Create /SC ONEVENT /MO ONSTART/TN ON_START /tr "c:\some.bat"
Its possible also to be added data on how to execute scripts on shutdown or logoff - by handling events with SCHTASKS or through registry entries.
There are few things that eventually can be added. The registry keys that can start a program at the start are (here's the doc https://learn.microsoft.com/en-us/windo ... istry-keys):
on machine level:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
for the current user:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
All of them are managed by RunOnce.exe. The RunOnce keys are more interesting as the RunOnce.exe deletes the values from the registry once the program is ran. The more interesting thing in RunOnce keys is that you can run them in safe mode!!
The command should be prefixed with asterix.
To prevent deletion you can use exclamation (I don't know if the asterix and exclamation can be combined). For all of them limit is 260 chars.
There are also two start up folders - one for the current user and one for the whole machine:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
And with task scheduler - the command line gives more control (though this is covered in the SCHTASKS page):
SCHTASKS /Create /SC ONEVENT /MO ONLOGON /TN ON_LOGON /tr "c:\some.bat"
SCHTASKS /Create /SC ONEVENT /MO ONSTART/TN ON_START /tr "c:\some.bat"
Its possible also to be added data on how to execute scripts on shutdown or logoff - by handling events with SCHTASKS or through registry entries.