Preserving and Restoring the Working Directory Setting (CD command)

The original working directory can be preserved with the PRESERVE command and later restored with the RESTORE command.

Example

CD '/sales/data'.
PRESERVE.
CD '/commands/examples'.
RESTORE.
  • PRESERVE retains the working directory location set on the preceding CD command.
  • The second CD command changes the working directory.
  • RESTORE resets the working directory back to /sales/data.