我在C:\some\path\startup.q
上有一个q脚本,可以将其他几个q脚本加载到当前会话中,如下所示
\l C:\some\other\path\script1.q
\l C:\some\other\path\script2.q
\l C:\some\other\path\script3.q
现在,我可能想要检查script1.q
等的几条路径。例如。当我在部署环境而不是本地环境中时,这些路径是不同的。 所以我想尝试按照
@[\l;C:\some\other\path\script1.q;`errormessage]
当然是胡说八道。但我在q中找到system
命令,其中描述了here。例如
\w / lists memory usage
system "w" / same command
但是,这不适用于\l
system "l C:\some\path\startup.q"
感谢您的帮助
答案 0 :(得分:4)
您需要转义反斜杠或使用Unix风格的路径,例如
system "l C:/some/path/startup.q"
所以使用异常处理:
@[system; "l C:/some/path/startup.q"; `errormsg]
答案 1 :(得分:2)
反斜杠是kdb中字符串的转义字符,因此文件路径中的反斜杠会阻止系统命令工作。要解决此问题,您需要转义反斜杠。
使用以下内容应该适合您:
system "l C:\\some\\path\\startup.q"