DOS (at least any MS-DOS) doesn't idle the CPU with the x86 HLT
instruction like most modern operating systems when it is not doing anything.
Not sure of the specific MS-DOS function that waits for a keypress, but that would probably be where the the CPU is effectively "spinlocking" in a loop when it is doing nothing, under MS-DOS. It is still fetching instructions and running, just not being productive.
Looks like newer versions of FreeDOS will do this, though.
You may find this helpful.
A simple way to accomplish this, is to copy the Windows directory over and over, just making additional copies of it, until you run out of space. Delete the copies you just created. Then do it again as many times as you feel necessary (passes).
This is effectively overwriting all free space on the disk.
UPDATED:
Here is a batch file to automate the process. I tested it on an old version of FreeDOS running in a VMware guest. I think it should work on DOS 5 and newer.
Put this file at the root of your C: drive (ie: C:\CLEAN.BAT
) and run it from there.
Each time it is run, it will "overwrite" once. Then you must delete all the files in the C:\TMP
directory to free up the space (C:\TMP>DEL *.*
). (I didn't want the batch file to delete any files on its own, just in case.)
You can run it as many times as you feel is necessary. Each time you run it is a single overwrite, so you might want to run it a couple or three times to be safe.
CLEAN.BAT
@ECHO OFF
IF "%1"=="" GOTO :INIT
:PARSE
SET ARG1=%1
SET ARG2=%2
SET ARG3=%3
SET ARG4=%4
IF NOT "%4"=="" GOTO :LAST
IF NOT "%3"=="" GOTO :LOOP4
IF NOT "%2"=="" GOTO :LOOP3
IF NOT "%1"=="" GOTO :LOOP2
:INIT
C:
CD\
IF NOT EXIST "C:\TMP\" MKDIR C:\TMP >NUL
CHDIR C:\TMP
COPY C:\WINDOWS\SETUP.EXE SETUP.EXE >NUL
COPY SETUP.EXE+SETUP.EXE FILE.0 >NUL
:LOOP1
FOR %%E IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9 0) DO CALL C:\CLEAN.BAT %%E
GOTO :END
:LOOP2
FOR %%F IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9 0) DO CALL C:\CLEAN.BAT %ARG1% %%F
GOTO :END
:LOOP3
FOR %%G IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9 0) DO CALL C:\CLEAN.BAT %ARG1% %ARG2% %%G
GOTO :END
:LOOP4
FOR %%H IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9 0) DO CALL C:\CLEAN.BAT %ARG1% %ARG2% %ARG3% %%H
GOTO :END
:LAST
COPY FILE.0 F%ARG1%%ARG2%%ARG3%%ARG4%.0
IF NOT "%ERRORLEVEL%"=="0" EXIT
GOTO :END
:END
The SETUP.EXE file in my Windows 3.1 directory is just under 500KB. To speed the process up a bit, I copy it (twice) to a new file and use it, so the process will effectively wipe all but about 950KB of the drive. You can pick a smaller file to get more granular, but you may run into issues with having too many files in a single directory.
Also, FreeDOS doesn't change the errorlevel
when a copy operation fails. MSDOS has always been good about the errorlevel
responses, so you shouldn't run in to that. If it does start saying it failed to copy the temporary file because of disk space, you can safely stop (Ctrl+C
) the process.
Best Answer
No Microsoft-supported way to do it
Windows GUI cannot be separated from the kernel and runtime libraries that support Win32 programs (in Windows 98).
You can get Windows without the GUI only using Server Core install mode in Windows Server 2008.
3rd party Win32 emulation for DOS
There is a software that emulates Win32 API and allows Windows console programs to be run under DOS. For example, HX DOS Extender homepage says:
Digital Mars C++ is specifically supported by HX DOS Extender, however .NET is integrated deeply into Windows. I doubt you'll be able to run .NET software on an emulator.
Warning, possible malware in HX DOS Extender download!
Apparently there is something fishy with downloads available on HX DOS Extender web site. Virustotal report looks really suspicious to me, most antiviruses report some kind of malware inside.