Discussion:
HPFS/JFS file specs & CMD.EXE (non-Rexx)
(too old to reply)
A.D. Fundum
2015-12-22 11:14:25 UTC
Permalink
I'm trying to avoid the use of Rexx. Is there a way to detect an empty
argument in CMD files, which supports any valid long file name syntax?

This TEST.CMD won't work if the argument is "Test:

REM This is TEST.CMD
IF '%1'=='' GOTO End
CD %1
:End


[R:\]IF '"Test'=='' GOTO End

SYS1003: The syntax of the command is incorrect.


This should work (i.e. is a valid syntax), hence the use of a single
":

CD "Test

I assume that it's a missing CMD.EXE feature, but perhaps there's a
trick. Both Test and "Test" will work, but "Test won't. I've already
tried different characters, including <ESC> instead of quote
characters.


--
Steven Levine
2015-12-22 16:39:09 UTC
Permalink
Post by A.D. Fundum
I'm trying to avoid the use of Rexx. Is there a way to detect an empty
argument in CMD files, which supports any valid long file name syntax?
Good luck with this. CMD.EXE has been and always will be brain-dead
when it come to string handling.
Post by A.D. Fundum
REM This is TEST.CMD
IF '%1'=='' GOTO End
CD %1
:End
[R:\]IF '"Test'=='' GOTO End
SYS1003: The syntax of the command is incorrect.
The reason for the syntax error is you are confusing variables with
what is effect macro substitution. CMD.EXE substibutes the variable
values into your command line and then interprets the result. It
always do not truely understand quoted strings. Most of the time
balanced quotes will work, but not always.
Post by A.D. Fundum
This should work (i.e. is a valid syntax),
No it's not. Syntax is checked after variable substitution.

Steven
--
---------------------------------------------------------------------
Steven Levine <***@earthlink.bogus.net>
DIY/Warp/eCS etc. www.scoug.com
---------------------------------------------------------------------
A.D. Fundum
2015-12-31 08:51:27 UTC
Permalink
Good luck with this. CMD.EXE has been and always will be
brain-dead when it come to string handling.
Thanks, I'll stick to using Rexx. If ObjectRexx stops working (known
shared memory issue), then so will my app. I did understund the
substitution, FWIW.
Post by A.D. Fundum
SYS1003: The syntax of the command is incorrect.
This should work (i.e. is a valid syntax),
No it's not. Syntax is checked after variable substitution.
To an user it's valid. If CMD.EXE's ...

CD "\

... works, then the command ...

MYCD.CMD "\

... should work too. It doesn't work because of the IF, but from an
user's point of view using a single double-quote is a valid syntax.
Apples and oranges, CD's parameter vs. IF's condition.


--
Marcel Mueller
2015-12-31 17:13:33 UTC
Permalink
Post by A.D. Fundum
Thanks, I'll stick to using Rexx. If ObjectRexx stops working (known
shared memory issue), then so will my app.
If you restart all applications that use REXX (including PMShell) ORexx
recovers from lost memory.

If Classic REXX is an option this does not share this issue.

Maybe other interpreter languages are an option too. Perl comes into my
mind at first.


Marcel
A.D. Fundum
2016-01-03 14:50:07 UTC
Permalink
Post by Marcel Mueller
Post by A.D. Fundum
Thanks, I'll stick to using Rexx.
Maybe other interpreter languages are an option too.
As such that's true. Now Rexx is used to parse the argument(s)
correctly before it executes the CD command, but a REXX.DLL crash is
not the best reason to not execute a CD command. A clean CMD.EXE batch
file was smaller too, but apparently there's no trick to avoid the
"problem" of the single quote, so the intended gain is lost. Any
useful interpreter language for OS/2 should be able to parse arguments
and to execute (the equivalent of) a CD command indeed, including the
more stable Rexx instead of ObjectRexx.


--

Loading...