Reply 1 of 18, by SquallStrife
- Rank
- l33t
By what logic? Windows starts when you type WIN because there's a file called WIN.COM in the Windows directory.
COMMAND.COM accepts 3 file extensions as executables: COM, EXE and BAT.
VogonsDrivers.com | Link | News Thread
Reply 2 of 18, by Gemini000
- Rank
- l33t
Though I suppose if you REALLY wanted to you could write a shell to COMMAND.COM that would just pass commands straight through normally, or if you enter the name of a file alone it will check the directory to see if any files exist with that name with a particular extension and run a registered program with that file as an argument.
...but then, why would you want to go through all this? Especially nowadays? :P
--- Kris Asick (Gemini)
--- Pixelmusement Website: www.pixelships.com
--- Ancient DOS Games Webshow: www.pixelships.com/adg
Reply 3 of 18, by Stojke
- Rank
- l33t
By logic of , since i can run bat, com, exe i should be able to run any other.
All i want is to call a program to use the file whos name.extension i entered.
Why do anything? Because its interesting.
Plus, i don't want anything else but MS DOS 6.22 and W 3.11 on this laptop. And instead of typing PROGRAM FILENAME.EXTENSION every time, i could simplify it by just writing the file name. And i wouldn't have to place a shit load of files into one single directory, because writing: program_name LOCATION\FILE.EXTENSION is too time taking.
Reply 4 of 18, by Gemini000
- Rank
- l33t
As SquallStrife already stated, COMMAND.COM, the program that forms the command line interpreter for DOS (ie: the DOS prompt itself) is only able to recognize EXE, COM and BAT files, since these can actually be executed. All other files are non-executable, meaning to load such a file directly from the command prompt, DOS would somehow have to know what program to run with the file indicated as the command line argument, and AFAIK, there's nothing that can do that.
Which brings me back to what I said: You would need to write your own DOS command interpreter to run overtop of COMMAND.COM itself which would scan any filenames entered without their extension to determine if such a file exists, and if it does, to run it using a mapped program. Everything else would be passed on to COMMAND.COM to do its thing.
Feel free to write such a program if you feel like it. ;)
The reason Windows can do this is because Windows has a mapping of various file extensions, referred to as "associated programs", which are executed with the selected file as an argument. The table is actually pretty huge on most modern systems, having to account for hundreds of potential formats. Windows was designed to do this. DOS was not. :P
--- Kris Asick (Gemini)
--- Pixelmusement Website: www.pixelships.com
--- Ancient DOS Games Webshow: www.pixelships.com/adg
Reply 5 of 18, by PeterLI
Considering installing 4DOS. It makes DOS life a lot easier.
Reply 6 of 18, by SquallStrife
- Rank
- l33t
wrote:By logic of , since i can run bat, com, exe i should be able to run any other.
No you shouldn't, because files with extensions other than those three are not programs.
I think you way overestimate how much "smarts" are in COMMAND.COM.
Practically all it does is poke some values into some CPU registers, read the executable part of the file into the lower 640KB, and JMP the CPU to the appropriate address.
http://stackoverflow.com/questions/3715618/ho … ram-into-memory
wrote:All i want is to call a program to use the file whos name.extension i entered.
That's why you have Windows! 😉
But seriously, beyond reading executables into conventional memory and JMP'ing to them, you'll need some kind of extension. PeterLI mentioned 4DOS, there's also XTree Gold, or one of the various XYZ Commander clones, something like that could offer what you're after. But it's way beyond the scope of what DOS's command interpreter is capable of.
VogonsDrivers.com | Link | News Thread
Reply 7 of 18, by Stojke
- Rank
- l33t
hmm... That is quite lame if it wasn't possible to do shortcuts.
I thought it would be possible since i can write WIN anywhere in any directory and it starts windows (after installed 3.11).
So i guessed there is an configuration file that handles this stuff where i would at least write the location of a program i like and be able to call it from any folder for the file in that folder i am in.
Reply 8 of 18, by PeterLI
With PATH in the AUTOEXEC you can add directories for easy pull up.
@ECHO OFF
PATH=C:\DOS;C:\;C:\GAMES\PCMAN;
When you call PCMAN from anywhere it will launch straight up. However: some programs want you to launch from the directory the file resides in to work.
Reply 9 of 18, by senrew
- Rank
- Oldbie
Uhm...why not just add the directories that contain the programs you want to run by just calling them into PATH statements in your autoexec.bat?
Example: Add PATH=C:\WAR2 to your autoexec and then just type War2 from anywhere and it'll find it?
EDIT: Damn, got to it as I was typing mine up.
Halcyon: PC Chips M525, P100, 64MB, Millenium 1, Voodoo1, AWE64, DVD, Win95B
Reply 10 of 18, by Stojke
- Rank
- l33t
Reply 11 of 18, by jwt27
- Rank
- Oldbie
I personally prefer keeping the path variable as short as possible, and make BAT files as shortcuts in C:\DOS\BIN. I find this method a bit more versatile, as you can also do things like changing the working directory to the program's dir:
@ECHO OFF
PUSHD
D:
CD \PATH\TO\PROGRAM\
PROGRAM.EXE /A /B %1 %2 %3
POPD
or load drivers quickly: (I use this for SoftMPU, network drivers and CD drivers, for example)
@ECHO OFF
IF NOT "%DRIVER_LOADED%"=="" GOTO END
DEVLOAD /H C:\DOS\DRIVERS\DRIVER.SYS
:END
SET DRIVER_LOADED=1
Another method is using the ALIAS command found in FreeCOM and 4DOS, like: ALIAS LS=*LS --color=auto -haGX.
Reply 12 of 18, by SquallStrife
- Rank
- l33t
wrote:I thought it would be possible since i can write WIN anywhere in any directory and it starts windows (after installed 3.11).
That's because there's a program called WIN.COM in C:\WINDOWS, which is in your PATH variable.
wrote:So i guessed there is an configuration file that handles this stuff where i would at least write the location of a program i like and be able to call it from any folder for the file in that folder i am in.
Still sounds like you want to be able to type FILENAME.TXT and have it automatically fire up EDIT or whatever...
wrote:Perfect! That works exactly as i wanted it 😁
...but OK. If that's what you actually wanted, we probably could have helped you sooner.
wrote:What i did was : SET PAT=%PATH%;D:\DATA\program.exe
Now i can simply write "program" "filename" anywhere on the internal and external mediums and get it to open the file 😀
You don't need "program.exe" in there. D:\DATA is enough, and you'll be able to run any program in that directory from anywhere.
VogonsDrivers.com | Link | News Thread
Reply 13 of 18, by Stojke
Reply 14 of 18, by SquallStrife
- Rank
- l33t
wrote:All i wanted was to be able to call this program from any directory i am in.
Since it has its own built in file browser.
Cool, but that's not what you asked in the original post (or at least the way I interpreted it). Glad you got it working the way you want though! 😀
VogonsDrivers.com | Link | News Thread
Reply 15 of 18, by Gemini000
- Rank
- l33t
Yeah, what you originally asked Stojke sounded like you wanted to do this:
C:\ANYDIR> readme
...as opposed to this:
C:\ANYDIR> c:\textedit\textedit readme.txt
...yet what you ACTUALLY wanted to do was this:
C:\ANYDIR> textedit readme.txt
But yeah, if it's working the way you wanted to now, then that's good. :)
--- Kris Asick (Gemini)
--- Pixelmusement Website: www.pixelships.com
--- Ancient DOS Games Webshow: www.pixelships.com/adg
Reply 16 of 18, by Stojke
- Rank
- l33t
Yeah, at first i thought only about that actually, but than realized that all i would need is just being able to write program name and than file name.type from any directory where that program doesn't exist (since i saw i can do the same with win and crystal cs32mix).
Thanks for your help 😀
Reply 17 of 18, by Malik
- Rank
- l33t
Like SquallStrife and Gemini000, I was breaking my head, trying to understand what on earth the initial question was about. I guess it was wrongly phrased or conveyed a different meaning. But I guess PeterLI and senrew somehow understood the question perfectly.