Invoking External Programs

Get current working directory

This is helpful thing to do. The command to use will vary on your OS. Most operating systems have the ‘pwd’ command with the exception of windows for which if you type ‘cd’ it will give you back the current working directory.

Here’s a code snippet that works under windows:

Notice we clip off the \n character and append a \. The single \ character is escaped as two \\ characters.

Leave A Comment?