run a cache terminal script from cmd/ batch.

Primary tabs

Hello everyone, I'm trying to run a cache terminal script from cmd/ batch.
I run it like this C:\MyCache\bin#cterm.exe C:\Users\Me\Desktop\cache_scrip.scr
The command opens a terminal, but nothing happens, no title present, no log file written, no output, it's just stucked.
Here is my script:

case match: off
title MyTitle
; wait for the terminal to initialize and ask for our identification
echo: on
wait for:Username
send: MeUser<CR>
wait for:Password
send: mepass<CR>
logfile: C:\Users\Me\Desktop\cache_script.log
send: znspace "ME_NAMESPACE"<CR>
wait for:ME_NAMESPACE>
send: do ##class(Me.MeMethod).UpdateRecordForCustomerId(1)<CR>
send: do ##class(Me.MeMethod).UpdateRecordForCustomerId(2)<CR>
send: do ##class(Me.MeMethod).UpdateRecordForCustomerId(3)<CR>
; finish the session
send: <CR>
; finished

Thank you for your help


I believe this is because you need to add a connection string to tell the terminal which instance to connect to. Please see this documentation for information on how to connect to a local instance or a remote instance

Well, your answers helped.
I've run the script using:
C:\InterSystems\Cache\bin\cterm.exe /console=cn_iptcp:[23] C:\Users\ME\Desktop\cache_script_for_rest_call.scr
But now I have the following error:
TCP connect() failed - exception satisfied select().
Reason: (10061, 0x274d)) No connection could be made because the target machine actively refused it

Specifically, since you are trying to connect to port 23 on your local Windows machine you will need the Telnet service enabled. It's called %Service_Telnet.

Assuming you end up satisfied with Robert's answer, please remember to be a good DC citizen by setting the big checkmark alongside the header of his answer. Only you as OP can do this.

If you're connecting to the local system, you don't need to use Telnet. Use the cn_ap option described in the link that Peter posted.

Where is your info to specify host?   /console=cn_iptcp : hostname[port]


I take it that the # after bin is a typo and you should have a \ there?