# Directives

CWDIR | Change Working Directory

## Format

CWDIR new_dir$[,ERR=stmtref]
Where:

new_dir$ | String expression. Name of the new directory in which you want to work or run applications. Include a disk letter and colon ":" to change to another drive.
stmtref | Program line number or statement label to which to transfer control.

## Description

Use the CWDIR directive to change from the current working directory to a new one. If the specified directory name does not exist, PxPlus returns an Error #12: File does not exist (or already exists).

## See Also

LWD Current Working Directory
HWD Starting/Home Directory

## Example

cwdir "C:\"+C$+"PROGS"
run "SOMETHING"
cwdir hwd ! Return home