ChDir (statement)

Syntax ChDir newdir$
Description Changes the current directory of the specified drive to newdir$. This routine will not change the current drive. (See ChDrive [statement].)
Example This example saves the current directory, then changes to the root directory, displays the old and new directories, restores the old directory, and displays it.
Const crlf = Chr$(13) + Chr$(10)
Sub Main()
????save$ = CurDir$
????ChDir(Basic.PathSeparator$)
????MsgBox "Old directory: " & save$ & crlf & "New directory: " & CurDir$
????ChDir(save$)
????MsgBox "Directory restored to: " & CurDir$
End Sub
See Also ChDrive (statement); CurDir, CurDir$ (functions); Dir, Dir$ (functions); MkDir (statement); RmDir (statement).