Passing arguments to scripts in Windows?
[1/11] from: depotcity::telus::net at: 22-Jun-2001 1:26
Hello again.
Being able to pass arguments to a script via the command prompt would be very handy.
But I can't seem to make it work. Any ideas?
Terry Brownell
[2/11] from: louisaturk:eudoramail at: 22-Jun-2001 5:03
Terry,
Check the www.rebol.com site for info on rebol/view/pro or
rebol/command. I think they offer that feature (but I'm not sure).
Louis
At 01:26 AM 6/22/2001 -0700, you wrote:
[3/11] from: depotcity:telus at: 22-Jun-2001 10:18
Hi all.
It was this article that got me inspired. But it seems to Unix based? The
examples don't work for me on my win2k machine. It's straight forward to
create a little script from the shell, but I'm looking for a simple way to,
among other things, pass a variable to a script... eg:
Let's say we have this script on the server called print-it.r...
rebol []
print x
... and we want to send the variable "x" via the shell (somehow?)...
c:\rebol\print-it.r "x: {blah blah blah}"
TBrownell
[4/11] from: sterling:rebol at: 22-Jun-2001 10:52
How about:
c:\path\to\rebol print-it.r "blah blah blah"
where print-it.r is:
REBOL []
probe system/options/args
Does that do what you want?
Sterling
[5/11] from: arolls::bigpond::net::au at: 23-Jun-2001 4:05
Re: Passing arguments to scripts in Windows? - system/script/args
> pass a variable to a script... eg:
>
> Let's say we have this script on the server called print-it.r...
rebol []
probe system/script/args ; you could then 'do this
wait 5 ; so we have time to see it
> c:\rebol\print-it.r "x: {blah blah blah}"
should open a rebol console and print "x: {blah blah blah}"
Anton.
[6/11] from: depotcity:telus at: 22-Jun-2001 11:14
Re: Passing arguments to scripts in Windows?
YES!
but I needed to add the path to the script as well...
c:\path\to\rebol path\to\script.r "blah blah blah"
Thank you.
Terry
[7/11] from: jeff:rebol at: 22-Jun-2001 11:18
Howdy, Terry:
> It was this article that got me inspired. But it seems to
> Unix based? The examples don't work for me on my win2k
> machine.
Here's how you can bundle a .bat file and REBOL script
together:
;-- FILE: c:\bin\tst.bat ------------------------------
@echo off
c:\bin\rebol.exe -s c:\bin\tst.bat %1 %2 %3 %4 %5 %6 %7
GOTO :EOF
REBOL []
print [
"Args:"
mold system/options/args newline
mold system/script/args
]
halt
;-----------------------------------------------------
I don't know bat syntax for sending "ALL of the args", and I
don't know if there is as I've seen the above before a number
of times.
You can also use cygnus bash shell too! :)
-jeff
[8/11] from: dness:home at: 22-Jun-2001 14:30
Jeff Kreis wrote:
>
> I don't know bat syntax for sending "ALL of the args", and I
> don't know if there is as I've seen the above before a number
> of times.
>
I think it's `%*' but it works only in the NT family, not in the
98 family of windows.
Bless those wonderful guys in Redmond for their consistency...
[9/11] from: ingo:2b1 at: 22-Jun-2001 20:32
Hi Terry,
here's a little script:
[REBOL []
x: none
print ["system/options/args" mold system/options/args]
print ["system/script/args " mold system/script/args]
do system/script/args
print ["x is" mold x]
]
Which started as:
[ingo--smrgol] ingo > r print-it.r -- x: {hi}
will result in:
system/options/args ["x:" "{hi}"]
system/script/args "x: {hi}"
x is "hi"
(I think it changed for /Core 2.5, everything after "--"
will be sent directly to the script, so it is even possible
to send arguments to user.r).
kind regards,
Ingo
Once upon a time Terry Brownell spoketh thus:
> Hi all.
> It was this article that got me inspired. But it seems to Unix based? The
<<quoted lines omitted: 42>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
do http://www.2b1.de/
_ . _
ingo@)|_ /| _| _ <We ARE all ONE www._|_o _ _ ._ _
www./_|_) |o(_|(/_ We ARE all FREE> ingo@| |(_|o(_)| (_|
._| ._|
[10/11] from: brett:codeconscious at: 22-Jun-2001 22:38
This is related.
http://www.escribe.com/internet/rebol/m9744.html
Brett.
[11/11] from: joel:neely:fedex at: 22-Jun-2001 8:02
Hi, Terry,
Also see
http://www.rebolforces.com/articles/rebolandtheshell.html
for a discussion with lots of examples, thanks to Jeff.
-jn-
Terry Brownell wrote:
> Being able to pass arguments to a script via the command prompt
> would be very handy. But I can't seem to make it work.
> Any ideas?
>
--
It's turtles all the way down!
joel'dot'neely'at'fedex'dot'com
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted