Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It seems that every time the start directory of SystemDialogInput is always the same, is it possible to set the start directory to the last used directory?

For example:


enter image description here will start from the "Documents" directory, if I change to other directory and select some file, and run the second input dialog


it forgets the directory I chose in the first SystemDialogInput and starts from "Documents" directory again. Is it possible to set SystemDialogInput to always remember the last used directory?

share|improve this question
Use the second argument of SystemDialogInput, and store the path in some variable. – Leonid Shifrin Jul 8 '13 at 22:55
up vote 4 down vote accepted

You should simple do something like this:

file = SystemDialogInput["FileOpen"]

SystemDialogInput["FileOpen", DirectoryName@file]

and your directory is the last one you've visited.

share|improve this answer
it's interesting. at first i started to write a RegularExpression and failed and then suddenly this nice function reared up...probably to often reinventing the wheel. – Stefan Jul 8 '13 at 23:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.