4.15 FAQ-374 什么是当前工作文件夹和收藏夹?
Last Update: 7/5/2018
命令窗口中的默认提示符(可通过选择菜单 Window: Command Window 或者 Alt + 3 打开)是“>>”,但您可以将当前工作文件夹设为提示,方法是于 Command Window 的右侧面板点击右键并选择 Preference...。
无论提示符是什么,Origin 都会首先在这个“当前目录”(CD)查找您正在运行的脚本文件。如果当前目录未更改,那么Origin首先会在用户文件夹中查找脚本文件,然后再于 Origin 程序文件夹中查找脚本文件。
要更改当前工作文件夹,您可以使用 cd X-Function。此外,Origin 还提供了用于管理预定义路径或收藏夹的 cdset X-Function,以便轻松更改当前工作文件夹。例如
cd; // output the current working folder cd c:\aaa; // set c:\aaa as the current working folder cdset 4; // set c:\aaa to pre-defined paths list, with index of 4 cdset; // output the pre-defined paths cd 2; // set the 2nd pre-defined path as the current working folder
注:
- 对于预定义的路径,最好保留用户文件夹的索引为1,因为这是默认分配并保存于 origin.ini 文件的 [cdset] 部分
- 如果用户文件文件夹的索引不为1,则可以利用同样存放用户文件夹路径的字符串寄存器 %Y 获取用户文件夹的路径。
Keywords:OGS, script, LabTalk, 脚本