On May 25, 10:02*am, Hylle <jens.hyllega...@newsgroup> wrote:
> I am trying to call a cmd with some parameters. Unfortunately one of
> them is the | symbol.
> Here is the call i make:
> cmd="cmd /c" & chr(34) & "Echo WEBTST" & vbtab & "Check Backup status"
> & vbtab & status & vbtab & "Backup completed ok" *& chr(124) &
> "files=" & files & ", folders=" & folders &", bytes=" & bytes &
> chr(34) & "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog
> wscript.echo cmd
> The call is trying to send input to the send_nsca.exe program, which
> requires TAB as the delimiter, and the chr(124) is the pipe symbol,
> the other pipe sign is working fine. I have tested including the ^
> sign before the chr(124). If i try to enter the command manually on a
> command prompt it works fine, but if it is the vbscript that does it,
> it complains that "files" is not a command. How do I escape the | sign
> so it works?
> Any hints?
> Jens Hyllegaard
It appears to me that there is a problemwith the two Chr(34)s. They
are creating an invalid statement. In addition, I found that the
escape character needs to be escaped, so that it requires THREE carats
to make the statement work. Try this ...
cmd="cmd /c" & "Echo WEBTST" & vbtab & "Check Backup status" _
& vbtab & status & vbtab & "Backup completed ok^^^|" _
& "files=" & files & ", folders=" & folders &", bytes=" & bytes _
& "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog