Page 1 of 1

run a (16-bit) .COM executable that has been renamed

Posted: 24 Feb 2012 08:21
by flatfly
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... Any thoughts??

Re: run a (16-bit) .COM executable that has been renamed

Posted: 24 Feb 2012 17:18
by foxidrive
The three things below seem to be entwined in getting a different extension recognised as executable.

I haven't tried it but maybe this page will give you some clues. http://www.microsoft.com/resources/docu ... x?mfr=true

I suspect that changing the master environment is needed rather than a cmd environment, and maybe associating the .cos with command.com is needed
The 16 bit subsystem comes into play in this task which could confuse the issue.


Ftype
ASSOC
PATHEXT

Re: run a (16-bit) .COM executable that has been renamed

Posted: 24 Feb 2012 21:45
by Aacini
I first copied tree.com as newtree.cos, then executed the following:

Code: Select all

C:\DOCUME~1\ANTONIO\MYDOCU~1\ASMB\MODERN~1\TESTS
>ASSOC .cos=ComAsCos
.cos=ComAsCos

C:\DOCUME~1\ANTONIO\MYDOCU~1\ASMB\MODERN~1\TESTS
>FTYPE ComAsCos=command.com %1 %*
ComAsCos=command.com %1 %*

C:\DOCUME~1\ANTONIO\MYDOCU~1\ASMB\MODERN~1\TESTS
>newtree.cos
Folder PATH listing
Volume serial number is CCA1-5338
C:.
No subfolders exist


So, to set .COS as executable extension equivalent to .COM, execute this Batch file:

Code: Select all

ASSOC .cos=ComAsCos
FTYPE ComAsCos=command.com %1 %*

Then just execute your program including the extension

EDIT: However, if the .COS files can't be read by you, then surely they can't be read by COMMAND.COM neither in order to execute they, so I am afraid that this method don't solve your problem either... :(

Re: run a (16-bit) .COM executable that has been renamed

Posted: 25 Feb 2012 04:18
by flatfly
thanks guys.
ideally I would need my script to do this without
modifying the environment... based on your suggestions,

I hoped that simply running "command.com /c program.cos", without
creating new filetypes, might work, but unfortunately, it doesn't
- it just returns "Bad command or file name".

Re: run a (16-bit) .COM executable that has been renamed

Posted: 25 Feb 2012 08:21
by Squashman
flatfly wrote: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).

You read but can't copy them? :?:
I know we could do some pretty tight file restrictions in Netware but I always thought if you could read the file you could copy it.

Re: run a (16-bit) .COM executable that has been renamed

Posted: 25 Feb 2012 08:35
by foxidrive
Just regarding restrictions, in the Windows recovery console you can't copy from just anywhere, by default.

Re: run a (16-bit) .COM executable that has been renamed

Posted: 25 Feb 2012 09:46
by Squashman
Hmm. I wonder if we could trick it with Alternate Data Streams.
You would still need the ability to modify some files system attributes.

Re: run a (16-bit) .COM executable that has been renamed

Posted: 25 Feb 2012 10:33
by alan_b
flatfly wrote:they are stored on read-only media and I can't copy them (special environment).

That really merits explanation.

What is "read-only media" ?
Is it a CD or DVD,
or a Flash Drive with a Write Protection switch or some autoruns/INF type of Intercept that overpowers the ability of Windows to write to it ?

How is the media formatted ?
NTFS, FAT32, or what ?

What is "special environment" and how does to prevent copying ?
Does this apply if you use a Boot CD or a Linux computer ?

A.C.L.s can grant/deny something like 2 dozen capabilities using CACLS,
and ICACLS has even more control.
and I remember seeing that EXECUTE was one of the "special skills".
but I am not aware of the capability to prohibit Copy and yet allow both Read and Execute.

I have used CACLS
I can read the HelP for ICACLS - but it makes my head hurt :cry:

Alan