To run a command as soon as the command prompt is opened
-
HKLM\Software\Microsoft\Command Processor\AutoRun
HKCU\Software\Microsoft\Command Processor\AutoRun
To run a command as soon as a user logs in -
The STARTUP folder (Start Menu)
HKLM\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Run
To run a command as soon as the machine powers up, (like AUTOEXEC.BAT
in MS-DOS), use the Windows Task Scheduler - choosing the option:
Run a task:
When my computer starts (before a user logs on)
Autoexec.bat file
The autoexec.bat file was an MS-DOS feature. Under Windows there is a still a degree of backwards compatibility - if the file (C:\autoexec.bat) exists, any SET statements within it will be parsed at boot time.
Variables
set in this way are not available to gui programs - they will be visible
from the CMD prompt but don't appear in the control panel. All other commands
in autoexec.bat will be ignored.
This behaviour is to allow old DOS applications to install correctly.
"The real danger is not that machines will begin to think like men, but
that men will begin to think like machines" - Sydney J. Harris
Related:
SCLIST - Display Services
SET - Display, set, or remove Windows environment
variables
Q137890 - SRVANY - create a User-Defined Service
Q243486 - AutoExNT Run a Batch File before Logging on (Windows 2000)