Reputation: 57
In COS I would like to return all the service with a specific name. In command running the command sc queryex type= service state= all | find /i "BFE" and it will display the service name. In COS there is $ZF that can take in a command but it return 0 not sure what i am doing incorrect.
USER>s cmd = "sc queryex type= service state= all | find /i ""BFE"""
USER>W cmd
sc queryex type= service state= all | find /i "BFE"
USER>set rc=$zf(-2,cmd)
USER>W rc
0
Upvotes: 0
Views: 104
Reputation: 46
I would also add that the $ZF(-1)
and $ZF(-2)
function is deprecated in the latest version. In the meantime, you can simply append >> resultfile.txt
to arg
and then review the file. I would however use $ZF(-1)
rather than $ZF(-2)
, which runs the command as a child-process, asynchronously.
Upvotes: 1
Reputation: 3205
in Caché we can call external command with the function $zf
, where the first argument could be -1
or -2
. Where $zf(-1)
waits, while command will be finished, as a result, will be exit code from this command. $zf(-2)
does not wait and as a result return 0
if the spawned process was successfully created, and -1
if not. In your case, you should use $zf(-1)
because you expecting to get some result immediately. But you have to redirect any output to some temporary file and read it after the call.
Upvotes: 3