Re: [Freedos-user] command.com and long commands: command.com, SET and detection

2021-06-03 Thread Bret Johnson
> Hi Jeremy, while you are at it:
>
> Wondering how Jerome could test whether the current shell
> is FreeCOM without needing temp files, ... FWIW, at one time I was trying to 
> figure out a way to automatically determine whether my executable program was 
> being called from the commend line (any command line -- FreeCOM or 
> COMMAND.COM or whatever) or whether I was being EXEC'd from another program.  
> I could never figure out a reliable way to do that.  The best I could do was 
> go back through the MCB chain and glean the name of my parent and compare it 
> to a list of known command shell names (COMMAND, 4DOS, etc. -- there are 
> several of them including the Windows & OS/2 command shells, and IIRC DOSBox 
> doesn't show any parent at all).  That turned out to be so unreliable and 
> convoluted that I abandoned the idea. I know you're not trying to do the 
> exact same thing, but it may be similar enough that it could give you some 
> ideas.  I'd be interested if you can figure anything out.___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


Re: [Freedos-user] command.com and long commands: command.com, SET and detection

2021-06-03 Thread Eric Auer


Hi Jeremy, while you are at it:

Wondering how Jerome could test whether the current shell
is FreeCOM without needing temp files, I found out that
half of the SET options are not yet listed in SET /? help.
The currently available actual options of SET would be:

SET test=one results in TEST=one
SET /C test=one results in test=one (keep case of variable name)
SET /U test=one results in TEST=ONE (uppercase variable value)
SET /P test=one shows "one:" as prompt, TEST = user entered value
SET /E test=one runs command "one", uses 1st returned line as value
SET /I displays information about environment size and memory usage

Note that SET /E requires a temp file, so it has the same
problem as pipelines: It only works with writeable temp dir.

You usually want to add a space after the prompt, for example:
"SET /P test=please enter a value " with " " after "value".

Also note that while SET /E test=vol sets TEST to the message
which VOL produces about your volume label (which will depend
on which language your FreeCOM has) you cannot SET /E test=ver
because VER always first displays one EMPTY line before starting
to show version information, so it behaves like "SET test=" and
deletes the varible TEST instead of setting it to anything ;-)

Maybe you could update the help messages. Thanks!

Do you have suggestions for easy, temp-file-free detection of
FreeCOM in BAT which works even with older versions of FreeCOM?

Regards, Eric



___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user