Re: getarg & 8.3 filename

From: Kevin G. Rhoads (kgrhoads_at_alum.mit.edu)
Date: 09/30/04


Date: Thu, 30 Sep 2004 13:12:42 +0000


>He's not putting the file name on the command line - he's double
>clicking it in Explorer. So he must have associated that file type
>with his program.

Yes. But beginning with Win3.1 (and perhaps earlier) whether you
drag and drop a file on executable's icon OR you double-click the
file and depend on file associations to launch the EXE, IF the EXE
is a legacy EXE, windows will provide the filename (8.3 alias in
later versions) on the command line when lauching the EXE.

It may well do that for all EXEs, not just legacy EXEs. But if
I create a DOS 16 bit real mode EXE and make an icon for it,
then dragging and dropping the file on that icon causes the
EXE to launch with the filename in the command tail. This
works in Win3.1, Win95, Win98, NT4, and WinXP. If I convert
the proggie to a QuickWin (with MS tools) or DefaultWin (with
Watcom) for a pseudo-windowed EXE for WIn3.1 (16 bit NE EXE)
it still works the same way under all those operating systems.
And if I make a 32 bit Console mode EXE, it still works that
way under those OSes.

THere may be ways using DDE, OLE or other things, but the command
tail way works fine starting with DOS EXEs and also when
they are run under true DOS -- and once I have a way to access
the command tail, I can retarget with minimal or no source changes.
(And I expect it is more readily portable to Unix/Linux/Be or
whatever than trying to exploit DDE or OLE or some other windows
specific stuff)

BUT -- I will only get the 8.3 name. Never an LFN. Since that
was symptom he described, I presumed this was the way he was
getting the filename (which may have been wrong, being an
assumption).

NOW with a modern 32 bin compiler running under
a recent Win32 OS, I can believe you could get the LFN from
the command tail.

But in file association launches, maybe
windows mistakes a modern EXE for a legacy EXE and provides
the 8.3 alias in some cases. That I've never investigated
(besides which MS would likely change the behavior with the
next release, maybe even with the next SP).



Relevant Pages

  • Re: Simple program not producing output
    ... Pasted the MSDN code into this code file. ... When to a command shell, located the exe. ... public static void PrintValues ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Simple program not producing output
    ... Pasted the MSDN code into this code file. ... When to a command shell, located the exe. ... public static void PrintValues ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Shell Functions and DOS executables
    ... I had to create a .BAT file that actually made the call to the exe, ... Dim wshExec As IWshRuntimeLibrary.wshExec ... I followed the above and the DOS command executes perfectly! ...
    (microsoft.public.vb.general.discussion)
  • Re: Alternate file types for RUN ?
    ... Some of my programs are actually invoked with the RUN command without ... you rename the resulting .EXE into .EXE_VAX ... alternate extension. ... $ show symb arch ...
    (comp.os.vms)
  • Re: How to pass and get parameter from command line in VB
    ... Look up the Command$ function in the help. ... for general programming questions like this you'd better see the ... Re: Passing a Runtime Parameter to a VB6 EXE: How To? ...
    (microsoft.public.vb.6.webdevelopment)