SetDirectory["dir"]
sets the current working directory to dir.
sets the current working directory to your "home" directory.


SetDirectory
SetDirectory["dir"]
sets the current working directory to dir.
sets the current working directory to your "home" directory.
Details

- SetDirectory sets the current working directory, then returns its full name.
- SetDirectory prepends the current working directory to the directory stack given by DirectoryStack[].
- For a relative path name, SetDirectory sets the directory relative to the current working directory.
- SetDirectory[] is equivalent to SetDirectory[$HomeDirectory].
- SetDirectory[File["dir"]] is also supported.
Examples
open all close allBasic Examples (1)
Set the current working directory:
Setting the directory pushes a directory onto the DirectoryStack:
Scope (1)
Set the current working directory to the directory specified by the File object:
Tech Notes
History
Introduced in 1991 (2.0) | Updated in 2008 (7.0) ▪ 2016 (11.0)
Text
Wolfram Research (1991), SetDirectory, Wolfram Language function, https://reference.wolfram.com/language/ref/SetDirectory.html (updated 2016).
CMS
Wolfram Language. 1991. "SetDirectory." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/SetDirectory.html.
APA
Wolfram Language. (1991). SetDirectory. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SetDirectory.html
BibTeX
@misc{reference.wolfram_2025_setdirectory, author="Wolfram Research", title="{SetDirectory}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/SetDirectory.html}", note=[Accessed: 15-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_setdirectory, organization={Wolfram Research}, title={SetDirectory}, year={2016}, url={https://reference.wolfram.com/language/ref/SetDirectory.html}, note=[Accessed: 15-August-2025]}