I was reading about architecture of MS-DOS and came across files like Autoexec.bat and config.sys.
Autoexec.bat a batch (.bat) file, which contained commands that were used to initialize paths, environment variables, CWD, Prompt etc. This file (along with config.sys) got automatically executed during the startup procedure of the OS (if they exist).
Since, MS-DOS and Command Prompt are for the most part same (or similar) to each other, I thought the same procedure would be carried over in current iterations of Windows OS as well.
Which seems understandable as when we start cmd we already are at a specific CWD every time, have a set of locations specified in path etc.
But it turns out, Windows XP and later versions of Windows OS didn't had one.
So I was thinking how does everything gets initialized now, and why did Autoexec.bat got removed?
43 Answers
Windows NT was a completely different OS that doesn't depend on DOS, therefore all of its descendants (including Windows 2000, not only XP and up) also don't use DOS things such as AUTOEXEC.BAT. That said there's an AUTOEXEC.NT in %SystemRoot%\system32 for setting up the environment when a DOS application is launched
Windows ME, despite in the Windows 9x line, also tried to move away from DOS. Therefore it only parses the environment variables in AUTOEXEC.BAT
1CONFIG.SYS set various options and loaded drivers with the DEVICE= and DEVICEHIGH= lines. It was read while DOS was starting.
When DOS completes initialization, it will start a shell. This is specified by the SHELL= line in CONFIG.SYS and is usually COMMAND.COM but doesn't have to be.
COMMAND.COM will run AUTOEXEC.BAT when it is started with the /P switch--this is typically specified in the CONFIG.SYS COMSPEC= line (examples) which means "make permanent" (it's not a "subshell"). A /D switch can suppress this.
The differences between DOS and other Microsoft operating systems goes back further than XP. It goes all the way back to 1993 when Windows was first working on the NT branch of Windows; then two years later when Windows 95 came out. Both the 9x branch and the NT branch, are different than MS-DOS under the hood - in the case of NT, vastly and extremely different.
NT Windows does the following different than MS-DOS as a rough, coarse overview of differences:
- Uses the CPU's protected mode to create a barrier between kernel and userspace.
- Expects multiple programs to be running and accessing the same disks, display, etc. apart from the primitive and limited TSR system of DOS.
- Has a messaging system that supports event-based programming, which is needed to support the input methodology of a GUI mouse-and-window interface.
- Has APIs (GDI, etc.) that need to be used to create windows, widgets, and modify the display.
- Expects programs to make system calls to talk to all devices and doesn't allow direct access to hardware.
- In the beginning NT didn't provide a lot of command-line tools available from COMMAND.COM or equivalent to achieve tasks in the operating system.
So the boot processes are different, and again, for the NT branch of Windows (which includes XP), extremely different.
Wikipedia has good articles on the details on Windows NT initialization.
9x Windows is much more like a multitasking extension on to of MS-DOS, with weird mechanisms in place to extend things to 32-bits. The boot process for 9x is a bit more similar to MS-DOS, this is a good description. Windows ME was the last of the 9x branch of Windows before Microsoft made XP both the consumer and business version of Windows, which is NT-based.
Startup is handled by Services and the Startup folder to start apps (See Task Manager Startup tab). There is no counterpart today to how DOS started. Since NT4, services can start without even logging on. Very different.
2