Changes the script's current working directory.
The name of the new working directory, which is assumed to be a subfolder of the current A_WorkingDir if an absolute path isn't specified.
ErrorLevel is set to 1 if there was a problem or 0 otherwise.
The script's working directory is the default directory that is used to access files and folders when an absolute path has not been specified. In the following example, the file My Filename.txt is assumed to be in A_WorkingDir:
FileAppend "A Line of Text", "My Filename.txt".
The script's working directory defaults to A_ScriptDir, regardless of how the script was launched. By contrast, the value of A_InitialWorkingDir is determined by how the script was launched. For example, if it was run via shortcut -- such as on the Start Menu -- its initial working directory is determined by the "Start in" field within the shortcut's properties.
Once changed, the new working directory is instantly and globally in effect throughout the script. All interrupted, paused, and newly launched threads are affected, including Timers.
A_WorkingDir, A_InitialWorkingDir, A_ScriptDir, DirSelect
SetWorkingDir A_ScriptDir SetWorkingDir "D:\My Folder\Temp"