Re: Executing shell commands from Ruby... again.



Jan Friedrich wrote:
How about this:

# -- BEGIN OF EXAMPLE

# setting command, param, input, output
# ...
cmd = <<END_OF_STRING
echo off
cd path\executabledir
#{command} -S #{param} #{input} #{output}
END_OF_STRING

system(cmd)

# -- END OF EXAMPLE

That makes perfect sense, but for some reason I'm getting this error:
: can't find string "END_OF_STRING" anywhere before EOF
: syntax error, unexpected $end, expecting tSTRING_CONTENT or
tSTRING_DBEG or tSTRING_DVAR or tSTRING_END

I'm still working on it, but this solution seems to be ideal as long as
I can get it to function properly.

Alex, you're exactly right, I certainly have no problems using variables
to construct a String. :) I was merely saying that the batch file
solution was insufficient because I can't create its content
dynamically. Thanks for your reply, I'll check out the file you
provided.

--
Posted via http://www.ruby-forum.com/.

.



Relevant Pages

  • Re: Persisting env vars in cmd windows
    ... The help text for the command you question goes like this: ... format by typing this: echo %date% ... If you don't then the batch file will fail. ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)
  • Re: Win2000 Printing Nightmare
    ... Purge the print spooler, to do so at a command prompt issue the ... You can make a small batch file to do the above job, ... @echo off ... ping localhost -n 4> nul ...
    (microsoft.public.win2000.file_system)
  • Re: logging batch files
    ... @echo off ... REM the start of your batch file ... >set LogCmd= ... >:LogIt ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Batch File Parameters
    ... While your batch file uses a number of advanced features, ... > @echo off ... > goto GETNEXT ... > a folder in "My Documents" and move them to an Archive folder while ...
    (microsoft.public.windowsxp.general)
  • Re: Disk Free Space Alert
    ... If you want a percentage then you can run this batch file: ... $goto Start ... $ echo Press the Space Bar to close this window. ... $echo Free space on drive %Drive% is %percent%%% of capacity ...
    (microsoft.public.win2000.general)