ChDir Statement

Changes and displays the current directory.

Syntax
(1) ChDir pathName
(2) ChDir

Parameters

pathName
Specify the path name to be changed, either directly as a string or as a string expression. See ChDisk for the details.

Description

  • (1) Changes to the specified directory by specifying the parameter.
  • (2) When the parameter is omitted, the current directory is displayed. This is used to display the current directory when it is not known.

ChDir is available only with the PC disk.

When executing this command by a program, enclose the name of path with ["].

The directory where the last project built on the connected controller was located is the current directory. If the controller does not have the build data, the root directory will be the current directory.

If you change the drive with ChDrive, the root directory will be the current directory.

The parameter is stored in compact flash in controller. Therefore, writing to command flash occurs when executing this command. Frequent writing to compact flash affect to lifetime of compact flash. We recommend to use this command minimally.

See Also
ChDrive, ChDisk, CurDir$

ChDir Statement Example
The following examples are done from the command window.

    > ChDir \        'Change current directory to the root directory
    > ChDir.. 'Change current directory to parent directory

    > Cd \TEST\H55   'Change current directory to \H55 in \TEST

    > Cd             'Display current directory
    A:\TEST\H55\

Program execution example

    > ChDir "\"        'Change current directory to the root directory
    ChDir ".." 'Change current directory to parent directory