4.15 FAQ-374 What is current working folder and favorite folders?

Last Update: 11/18/2024

The default prompt in the Command Window (Open by menu Window: Command Window, or Alt + 3) is ">>", but you could have the current working folder as prompt, by right-clicking inside the right panel of Command Window and choosing Preference... from context menu. Regardless of what prompt is, it is this "Current Directory" (CD) where Origin first looks to find the script file that you are running. If the current directory is not changed, Origin looks first for the script file in the User Files Folder and then in the Origin program folder.

To change the current working folder, you can use the cd X-Function. Also, Origin has provided the cdset X-Function for managing pre-defined paths or favorite folders, so to easily change the current working folder. For example:

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


Note:

  • For the pre-defined paths, it may be best to leave the index 1 reserved for User File Folder, as this is the default assignment. And the assignments get saved to the [cdset] section of the origin.ini file
  • If the index 1 is not for User Files Folder, you can instead use the String Register, %Y, which stores this path too.



Keywords:OGS, script, LabTalk