KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Changing the working directory for LAUNCH EXTERNAL PROCESS
PRODUCT: 4D | VERSION: 2004.1 | PLATFORM: Mac & Win
Published On: March 10, 2005

In 4D 2004, the command LAUNCH EXTERNAL PROCESS was introduced. This command allowed you to launch any program on the computer. A new feature in 4D 2004.1 is the ability to change the working directory when using LAUNCH EXTERNAL PROCESS.

To do this, you can add the following line to your code:

SET ENVIRONMENT VARIABLE(_4D_OPTION_CURRENT_DIRECTORY;YourPath)

For example, if you wanted to open a file called "mytext.txt" which is located in "C:\tmp" using "notepad.exe", you could execute the following code:

Code

This is especially useful when you are using applications that must be run from specific directories.