({{, (RefLink[SetDirectory, paclet:ref/SetDirectory])["dir"]
sets the current working directory to dir. }, {, (RefLink[SetDirectory, paclet:ref/SetDirectory])[]
sets the current working directory to your "home" directory.}})

OpenersNotesSection(Spacer1)Details

(RefLink[SetDirectory, paclet:ref/SetDirectory]) sets the current working directory, then returns its full name.

(RefLink[SetDirectory, paclet:ref/SetDirectory]) prepends the current working directory to the directory stack given by (RefLink[DirectoryStack, paclet:ref/DirectoryStack])[].

For a relative path name, (RefLink[SetDirectory, paclet:ref/SetDirectory]) sets the directory relative to the current working directory.

(RefLink[SetDirectory, paclet:ref/SetDirectory])[] is equivalent to (RefLink[SetDirectory, paclet:ref/SetDirectory])[(RefLink[$HomeDirectory, paclet:ref/$HomeDirectory])].

(RefLink[SetDirectory, paclet:ref/SetDirectory])[(RefLink[File, paclet:ref/File])["dir"]] is also supported.

OpenersPrimaryExamplesSection(Spacer1)Examples  (2)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Set the current working directory:

SetDirectory[$UserDocumentsDirectory]

Setting the directory pushes a directory onto the (RefLink[DirectoryStack, paclet:ref/DirectoryStack]):

DirectoryStack[]

Resetting the directory:

ResetDirectory[]

DirectoryStack[]

OpenersExampleSection1(Spacer1)Scope  (1)

Set the current working directory to the directory specified by the (RefLink[File, paclet:ref/File]) object:

SetDirectory[File[$InstallationDirectory]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ResetDirectory, paclet:ref/ResetDirectory])  ▪  (RefLink[Directory, paclet:ref/Directory])  ▪  (RefLink[DirectoryName, paclet:ref/DirectoryName])  ▪  (RefLink[$Path, paclet:ref/$Path])  ▪  (RefLink[SetCloudDirectory, paclet:ref/SetCloudDirectory])  ▪  (RefLink[ProcessDirectory, paclet:ref/ProcessDirectory])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Naming and Finding Files, paclet:tutorial/NamingAndFindingFiles])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Directories & Directory Operations, paclet:guide/DirectoriesAndDirectoryOperations])}, {▪(RefLinkPlain[Session Customization, paclet:guide/SessionCustomization])}, {▪(RefLinkPlain[Managing Content in the Cloud, paclet:guide/ManagingContentInTheCloud])}, {▪(RefLinkPlain[File Operations, paclet:guide/FileOperations])}, {▪(RefLinkPlain[External Operations, paclet:guide/ExternalOperations])}})}})