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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
flatfly
Posts: 3
Joined: 24 Feb 2012 08:13

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

#1 Post by flatfly » 24 Feb 2012 08:21

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??

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

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

#2 Post by foxidrive » 24 Feb 2012 17:18

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

Aacini
Expert
Posts: 1914
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

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

#3 Post by Aacini » 24 Feb 2012 21:45

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... :(

flatfly
Posts: 3
Joined: 24 Feb 2012 08:13

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

#4 Post by flatfly » 25 Feb 2012 04:18

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".

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

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

#5 Post by Squashman » 25 Feb 2012 08:21

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.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

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

#6 Post by foxidrive » 25 Feb 2012 08:35

Just regarding restrictions, in the Windows recovery console you can't copy from just anywhere, by default.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

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

#7 Post by Squashman » 25 Feb 2012 09:46

Hmm. I wonder if we could trick it with Alternate Data Streams.
You would still need the ability to modify some files system attributes.

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

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

#8 Post by alan_b » 25 Feb 2012 10:33

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

Post Reply