Using call with quotes
[1/4] from: rjbywater::clear::net::nz at: 20-Apr-2006 23:07
Hello,
I am wanting to use rebol/view to invoke a .bat file (in windows) which will subsequently
run a java program but that is by the by and need to pass parms to the bat file. These
parms can contain spaces so I need to surround the parm with quotes (").
My problem is that I can't see how to do this.
Given a .bat file that merely echoes the parms and then holds the DOS command window
open for 20 seconds (using ping) then this fragment works fine:
a: "parm1"
b: "parm2"
call reduce [%/c/ron/test1 a b]
and the DOS window opens and displays a = parm1 b = parm2 as I expect.
However when I change this to:
a: join {"} ["parm1" {"}]
b: "parm2"
in an attempt to put quotes round the parm then the DOS window is not displayed (or at
least it may open and close immediately).
Issuing print a however shows "parm1" which shows that the quoting worked.
Can anyone please explain what I am doing wrong.
Sorry if this seems basic but I'm just experimenting with Rebol.
Thanks
Ron
[2/4] from: apwing:zonnet:nl at: 20-Apr-2006 13:29
Hi Ron,
having tried something similar I found that it works fine for me using the
next script:
rebol []
dir: "c:\program files\*.*"
cmd: join "dir /s " [{"} dir {"}]
print cmd
call cmd
input
Did you take care of the mandatory spaces between the command and the
parameters?
Hope this helps!
Arie
[3/4] from: apwing:zonnet:nl at: 20-Apr-2006 13:38
Hi again,
in order to check the specific case of using a batch file I ran the
following rebol script:
rebol []
dir: "c:\program files\*.*"
cmd: join "dir.bat /s " [{"} dir {"}]
print cmd
call cmd
input
Which in turn runs the bat file called dir.bat (in same directory as rebol
script).
echo Parm1=%1
echo Parm2=%2
pause
The results displayed by dir.bat are:
D:\src\rebol>echo Parm1=/s
Parm1=/s
D:\src\rebol>echo Parm2="c:\program files\*.*"
Parm2="c:\program files\*.*"
D:\src\rebol>pause
Druk op een toets om door te gaan. . .
So, I assume all works just fine!
Regards
Arie
[4/4] from: rebol::list::2006::ingohohmann::de at: 20-Apr-2006 18:25
Hi,
'mold works for me, of works you have to be carefull, that
mold doesn't switch to {} kind of strings, because of the length ...
call reduce [%test.bat "test1" mold "test with spaces"]
Kind Regards,
Ingo
On Thu, 20 Apr 2006 13:38:47 +0200, Arie van Wingerden <apwing-zonnet.nl>
wrote: