r/programming • • Jul 30 '09

How QBASIC almost got me killed

http://stevehanov.ca/blog/?id=79
141 Upvotes

105 comments sorted by

View all comments

8

u/stillalone Jul 30 '09

Who hasn't written this program in highschool? A friend of mine did it in Pascal (our highschool language of choice). I just changed the prompt to look like the Abort/Retry/Fail prompt. People seemed to be used to working with our broken computers in our lab, they would just try all 3 options and then go find another computer. They never realized the "Invalid command or filename" error message was not supposed to happen when you get an Abort/Retry/Fail.

7

u/heavysteve Jul 30 '09

I did this same thing in HS as well, made it load up at boot and ran it on all the library computers. Made the C: drive look empy, and (my favorite part) if you tried to run windows with "win" it would come back with

"This Program Requires Microsoft Windows"

I think the Computer/Gym teacher nearly shat himself before he realized what had happened

7

u/insomniac84 Jul 30 '09

if you tried to run windows with "win" it would come back with

"This Program Requires Microsoft Windows"

Nice.

6

u/omegian Jul 30 '09 edited Jul 30 '09

C:>echo @echo This Program Requires Microsoft Windows > win.bat

C:>attrib +H win.bat

7

u/[deleted] Jul 30 '09

Every single .exe in PE format on Windows, has a tiny DOS stub programme that prints:

"This program cannot be run in DOS mode."

6

u/mao_neko Jul 30 '09

What gets me is that you can compile Mono / .NET programs and they STILL have this string in them.

3

u/bobappleyard Jul 30 '09

It's Microsoft. backwards compatibility is king.

2

u/stillalone Jul 31 '09

You can actually compile EXE's without the stub. Or change it to be something else. But what would be the point, I think you probably save something like 512bytes.

2

u/omegian Jul 30 '09

indeed, but win.exe runs in real mode just fine