Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to run a couple of 16-bit legacy DOS programs from a standard windows XP dos prompt. The problem is that the file extensions have been renamed from .COM to .COS and they are stored on read-only media and I can't copy them (special environment).

Any tips on how to invoke such files despite the weird extension? If they had been 32-bit EXEs, it wouldn't have been an issue running them even without their proper extensions, but with these COM files, I'm unable to find a way to run them.

share|improve this question
You should add more details about the environment, especially about your "special environment". – Robert Mar 2 '12 at 17:10
Figure out a way to burn a new copy of the media. They were created in some manner. – Ramhound Mar 2 '12 at 17:17

Ok. I have figured it out. I think, anyway. This takes advantage of the fact that DOS .COM files are just binary images with a 0x100 byte header, with the first couple bytes being a JMP 0x0100 (hopefully I'm right about that) and the old DOS utility debug which exists in XP.

  • open command prompt
  • cd to directory containing .COS files
  • debug [enter]
  • You are now at the debug.exe prompt (just a dash)
  • Type n{name of your .COS file, including extension} - substituting appropriately. For example, for FILE.COS type nfile.cos, then [enter]
  • Type l (for load) then [enter]
  • Type g (for go) then [enter]

Let me know how that goes. I loaded C:\windows\system32\ but evidently it's really an .EXE (says this cannot be run in DOS mode). Good luck.

(BTW I just read the stuff about up there, whoops!)

share|improve this answer
Yup, that could do the trick. Of course it’s a real pain and some serious limits like not being runnable from a batch file or the Run dialog. Not being able to copy them sure is frustrating isn’t it? :-( – Synetech May 4 '12 at 0:20

Look what I can do :-) (just did this in an XP DOS box):

C:\>md test

C:\>cd test

C:\test>xcopy c:\windows\system32\
1 File(s) copied

C:\test>md t1

C:\test>md t2

Volume in drive C is OSDisk
Volume Serial Number is 0006EFC4 9654:5A1E

C:\test>ren tree.cos

Volume in drive C is OSDisk
Volume Serial Number is 0006EFC4 9654:5A1E

C:\test>ren tree.cos newname.cos

Volume in drive C is OSDisk
Volume Serial Number is 0006EFC4 9654:5A1E


I.e. you obviously can execute cos files if you explicitely name the extension at the DOS prompt.

share|improve this answer
Nope; that is incorrect. The reason that works is because is not actually a .COM file, it is a .EXE file with a .com extension for backward-compatibility (as are almost all of the .COM files in Windows for quite a few versions now). If it were a true .COM file, it would have been opened with the default “all-files” program, or if none is set, then you would have been prompted with the Open With dialog box. – Synetech May 1 '12 at 8:21
True. Cool. Uncool that a simple type reveals that is has an MZ exe signature. Doh. So what would be the correct answer? "Not at all"? – TheBlastOne May 2 '12 at 18:43

No, I'm afraid that it is not possible to do what you want under the circumstances that you have outlined. Executable files are treated specially (due to their ability to infect a system), so Windows will not let you just run any old file as an executable.

The PATHEXT environment variable tells Windows what programs are "executable" and can be "run", but there are limits. Open a command-prompt and append .cos to pathext and try to run one of the .cos files:

> set pathext=.cos;%pathext%
> foobar.cos

You will see that either the default "all files" program runs, or if none is configured, that the Open With dialog is presented. Why? Because Windows restricts what can be run for safty reasons. You should be able to register .cos files as executable (like .py, .pl, etc.), but even then, it may not be possible since a .py or .pl file is actually just a document that is opened by a program, not an actual executable.

Another option might be to try to create an association whereby you tell the system that .cos files are comfiles. However, the quick test I just attempted did not work and Windows complained that it is not an executable file and returned access denied.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .