Continued lines (^) in a library routine?

May 20, 2008
10,623
81
Syracuse, NY, USA
Here's the first few lines of a library routine's source.

Code:
sv {
setlocal

set expression="LSM|TermService|EventLog|ProfSvc|Themes|EventSystem|Schedule|lmhosts|CryptSvc|SENS|PlugPlay^
            |SessionEnv|nsi|Winmgmt|TapiSrv|NlaSvc|LanmanServer|TapiSrv|Dhcp|DnsCache|SstpSvc|RpcEpt|FontCache|BFE^
            |UmRdp|RasMan|TrkWks|netprofm|ShellHWD|Dnscache|UserManager|LanmanWorkstation|Audio"

function tformat `%@instr[4,2,%1]/%@instr[6,2,%1] %@instr[8,2,%1]:%@instr[10,2,%1]:%@instr[12,2,%1]`
And here's how it winds up in memory.

Code:
sv {
setlocal
|UmRdp|RasMan|TrkWks|netprofm|ShellHWD|Dnscache|UserManager|LanmanWorkstation|Audio"
function tformat `%@instr[4,2,%1]/%@instr[6,2,%1] %@instr[8,2,%1]:%@instr[10,2,%1]:%@instr[12,2,%1]`
 
May 20, 2008
10,623
81
Syracuse, NY, USA
Is this a feature request, or a bug report that LIBRARY /R doesn't do something that it doesn't say it does?
Well, the help doesn't give any instructions for writing library functions. Until today, it seemed you could do anything in a library function that you can do in a batch file. If it needs to be requested, yes, it's a feature request. If there are other familiar constructs that don't work in library functions, they should mentioned in the help.
 
May 20, 2008
10,623
81
Syracuse, NY, USA
The number of things that you can't do is infinite. The things that you can do are documented in the help.
All I could find is

Library functions can call aliases, internal or external commands, batch files, or other library functions.
That's pretty sketchy, especially if library functions are significantly different from batch files. I just copy .BTMs to .LIBs and throw in the required "name {" and "}" ... no problem until the line continuation thingy cropped up.

Are we suppose to find out the hard way that things we're accustomed to doing in batch files can't be done in a library function? If there are so many, please describe several of them.
 
  • Like
Reactions: Fross
I've been using library functions extensively and, for what it's worth, I have not come across anything that hasn't worked like a batch file. However, I don't normally use line continuation. Hopefully that's one of a very small number of differences.

Michael