ASM.BAT
@msa %1 -o%~n1.com
Which *should*, if passed EXAMPLE.ASM, work out to
@msa EXAMPLE.ASM -oEXAMPLE.COM
the proper command-line format for the MSA assembler. Unfortunately,
it doesn't recognize it as an environment variable at all, and comes
out like so:
@msa EXAMPLE.ASM -o~n1.COM
You can see the problem. Is there an alternative approach to stripping
the extension from a batch-file argument?
> I'm throwing together some .BAT files to simplify some common tasks on
> my FreeDOS installation, and I'm having a little trouble. In the
> modern Windows cmd.exe shell, you can use ~n with an environment
> variable (i.e. a batch-file argument) to strip it of its extension:
> referencing %~n1 in a batch file that was passed a name like
> "example.txt" would simply reference "example", and it would be
> possible to append a new extension. Is this possible in FreeCOM? For
> example, I want to use this script:
environment variables (e.g. %name%) are different to batch arguments (e.g.
%1)
>
> ASM.BAT
>
> @msa %1 -o%~n1.com
>
> Which *should*, if passed EXAMPLE.ASM, work out to
>
> @msa EXAMPLE.ASM -oEXAMPLE.COM
>
> the proper command-line format for the MSA assembler. Unfortunately,
> it doesn't recognize it as an environment variable at all, and comes
> out like so:
>
> @msa EXAMPLE.ASM -o~n1.COM
>
> You can see the problem. Is there an alternative approach to stripping
> the extension from a batch-file argument?
Back in the day you'd probably require just the first part (name without
extension) so it'd be simply:
@msa %1.asm -o%1.com
use as "compile EXAMPLE"
but this won't work if passed a fullname from windows.
This code appears to be able to get the root name in W9x; it mighrt work
in Freedos.
http://www.ericphelps.com/batch/samples/rootname.bat.txt
--
"Nuns! NUNS! Reverse! Reverse!"