ChDir: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
(Created ChDir page)
 
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The '''ChDir''' command displays or changes the current default directory. '''CD''' with the -N parameter to change or display any output to the screen. Output may be redirected to a file. CD without the -N and drive parameter will parameter will continue to display the current drive. This could affect current program.
The '''ChDir''' command displays or changes the current directory. You may also use the '''CD''' command - it is identical to '''ChDir''' in effect, but is shorter.


====Comments and Examples====
If the CD command is not followed by a valid path, it will simply display the current directory.
For a display of the current default directory, type CHDIR and press <CR>.<br>
In order to switch to a different directory, the CD command must be followed by a valid path.
The following example sets the default drive to drive A:


;CHDIR A:
After the command is executed, the name of the new current directory is displayed on the screen, unless the -N flag is included in the CD command after the path.


If the current default directory is \sales and you wish to change it to \sales\december, any of the following commands will work:
==Syntax==
CHDIR [<[[drive]]>:\] [<path>\] [-N]


CHDIR \sales\december<br>
[[File:ChDirCommand.png]]
CHDIR december<br>
CHDIR /december


You can change the default directory by typing CHDIR, a space, and the parameters that specify the desired path (separate each parameter with a comma or a space). If the specified path does not begin with a backslash (indicating the root directory), the system automatically places the pre-existing default directory path before the path you specify.<br>
==Defaults==
Business Rules automatically displays the name of the new default directory after the CHDIR command has been executed. If this is undesirable, the -N option may be used to turn the display off.
 
====Syntax====
[[Image:HELP0032.jpg]]
 
====Defaults====
#Display the current directory drive and path.
#Display the current directory drive and path.
#Change the current drive.
#Change the current drive.
#Display the name of the new directory.
#Display the name of the new directory.


====Parameters====
==Parameters==
The syntax of the CHDIR command allows you to choose either the default or one of four optional syntactical routes.


The first parameter in the top route, "Drive", is a DOS-like drive letter; it must be followed by a colon. The results of this parameter depend upon whether or not it is followed by the "path" parameter. When specified by itself, "drive" causes Business Rules to change the default drive to the one specified.
The first optional parameter '''drive''' is the drive letter, which must be followed by a colon and a backslash. The results of this parameter depend upon whether or not it is followed by the '''path''' parameter. When specified by itself, '''drive''' causes BR to change the current drive to the one specified.


The "path" parameter may be specified after the drive letter (in the top route) to indicate the sequence of directories you wish to use as the default directory path. Each directory name must be preceded with a backslash (\\). If no backslash is present at the beginning of the directory name series, Business Rules automatically appends the newly specified path to the end of the current default directory path.
The '''path''' optional parameter may be specified after the drive letter to indicate the sequence of directories you wish to use as the current directory path. Each directory name must be preceded with a '''backslash \'''. If no backslash is present at the beginning of the directory name series, BR automatically appends the newly specified path to the end of the current directory path.


When path is specified, Business Rules changes the default directory on the specified drive, but it does not change the current drive. As an example, assume that the current default drive at your workstation is drive C. If you enter the following command, Business Rules will change the default drive to drive B:
When path is specified, BR changes the current directory on the specified drive, but it does not change the current drive. As an example, assume that the current drive at your workstation is drive C. If you enter the following command, BR will change the current drive to drive B:


  CHDIR B:
  CHDIR B:


But if you enter the following command, Business Rules will change the default subdirectory on drive B to \\BR\\DATA; the workstation will continue to access drive C, however:
However, if you enter the following command, BR will change the current subdirectory on drive B to \BR\DATA; yet the workstation will continue to access drive C:
 
CHDIR B:\BR\DATA
 
The '''-N''' option may be used to turn off the automatic display of the new directory. This can be useful with PROC NOECHO.
 
==Comments and Examples==
 
To display of the current directory, type CHDIR and press <ENTER>.
 
The following example sets the current drive to drive A:
 
CHDIR A:
 
If the current directory is \sales and you wish to change it to \sales\december, any of the following commands will work:
 
CHDIR \sales\december<br>
CHDIR december<br>
CHDIR /december
 
You can change the current directory by typing CHDIR, a space, and the parameters that specify the desired path (separate each parameter with a comma or a space). If the specified path does not begin with a backslash (indicating the root directory), the system automatically places the pre-existing current directory path before the path you specify.
 
BR automatically displays the name of the new current directory after the CHDIR command has been executed. If this is undesirable, the -N option may be used to turn the display off.
 
A valid path for the CD command may be:
 
* an absolute path,
* a relative path,
* a backslash,
* two dots
 
If you use the '''CD''' command with an invalid path (a path that does not exist, is misspelled, or otherwise incorrect), then you will get a [[4152]] error
 
Here are some more examples:
 
cd C:\BR\data\companies\ABC_company
 
In the example above, the CD command is used with an absolute path, in which the drive and the entire folder structure is included


  CHDIR B:\\BR\\DATA
  cd data\companies


The second route through the CHDIR syntax is the System/23-format equivalent to the top route. "/Subdirectory/" is the name of a subdirectory that is to become the new default; the forward slashes indicate System/23 format. "Drive-num" is a System/23 drive number which Business Rules translates into a drive letter according to the information in the BRConfig.sys file's S/23-DRIVES specification. When this parameter is specified without a preceding subdirectory name, Business Rules changes the current drive to the drive specified. When a drive-num is preceded by a subdirectory name, Business Rules changes the default directory on the specified drive to the named subdirectory, but it does not change the current drive.
In the example above, CD command is used with a relative path, which does not include the drive and the entire folder structure. Instead, this command assumes that the current directory has a sub-directory named data, which in turn also has a sub-directory called companies.


The third and fourth routes through the CHDIR syntax allow you to specify either the "path" or the "/subdirectory" parameters to change the default directory on the default drive. "Path" is the sequence of directories that is to become the default. When it is not preceded by a backslash, Business Rules automatically appends the specification to the end of the current default directory path. "/Subdirectory" is the System/23-format equivalent to the path parameter.
cd \
In the example above, CD command is used with a backslash, which changes the current directory to the root of the current directory tree. So if your current directory is C:\BR\data\companies\ABC_company, then after the '''CD \''' command is used, the current directory will become '''C:\'''


The "-N" option may be used to turn off the automatic display of the new directory. This can be useful with PROC NOECHO.
cd ..
In the example above, CD command is used with two dots, which changes the current directory to the parent of the current directory. So if your current directory is C:\BR\data\companies\ABC_company, then after the '''CD ..''' command is used, the current directory will become '''C:\BR\data\companies'''


====Technical Considerations====
cd ..\..
When "CD -N" is specified, the -N parameter will be overridden by the request for a display of the current directory.
In the example above, CD command is used with acombination of two dots, a backslash, and two more dots, which changes the current directory to the parent of the parent of the current directory. So if your current directory is C:\BR\data\companies\ABC_company, then after the '''CD ..\..''' command is used, the current directory will become '''C:\BR\data'''


<noinclude>
<noinclude>

Latest revision as of 16:32, 8 May 2014

The ChDir command displays or changes the current directory. You may also use the CD command - it is identical to ChDir in effect, but is shorter.

If the CD command is not followed by a valid path, it will simply display the current directory. In order to switch to a different directory, the CD command must be followed by a valid path.

After the command is executed, the name of the new current directory is displayed on the screen, unless the -N flag is included in the CD command after the path.

Syntax

CHDIR [<drive>:\] [<path>\] [-N]

Defaults

  1. Display the current directory drive and path.
  2. Change the current drive.
  3. Display the name of the new directory.

Parameters

The first optional parameter drive is the drive letter, which must be followed by a colon and a backslash. The results of this parameter depend upon whether or not it is followed by the path parameter. When specified by itself, drive causes BR to change the current drive to the one specified.

The path optional parameter may be specified after the drive letter to indicate the sequence of directories you wish to use as the current directory path. Each directory name must be preceded with a backslash \. If no backslash is present at the beginning of the directory name series, BR automatically appends the newly specified path to the end of the current directory path.

When path is specified, BR changes the current directory on the specified drive, but it does not change the current drive. As an example, assume that the current drive at your workstation is drive C. If you enter the following command, BR will change the current drive to drive B:

CHDIR B:

However, if you enter the following command, BR will change the current subdirectory on drive B to \BR\DATA; yet the workstation will continue to access drive C:

CHDIR B:\BR\DATA

The -N option may be used to turn off the automatic display of the new directory. This can be useful with PROC NOECHO.

Comments and Examples

To display of the current directory, type CHDIR and press <ENTER>.

The following example sets the current drive to drive A:

CHDIR A:

If the current directory is \sales and you wish to change it to \sales\december, any of the following commands will work:

CHDIR \sales\december
CHDIR december
CHDIR /december

You can change the current directory by typing CHDIR, a space, and the parameters that specify the desired path (separate each parameter with a comma or a space). If the specified path does not begin with a backslash (indicating the root directory), the system automatically places the pre-existing current directory path before the path you specify.

BR automatically displays the name of the new current directory after the CHDIR command has been executed. If this is undesirable, the -N option may be used to turn the display off.

A valid path for the CD command may be:

  • an absolute path,
  • a relative path,
  • a backslash,
  • two dots

If you use the CD command with an invalid path (a path that does not exist, is misspelled, or otherwise incorrect), then you will get a 4152 error

Here are some more examples:

cd C:\BR\data\companies\ABC_company

In the example above, the CD command is used with an absolute path, in which the drive and the entire folder structure is included

cd data\companies

In the example above, CD command is used with a relative path, which does not include the drive and the entire folder structure. Instead, this command assumes that the current directory has a sub-directory named data, which in turn also has a sub-directory called companies.

cd \

In the example above, CD command is used with a backslash, which changes the current directory to the root of the current directory tree. So if your current directory is C:\BR\data\companies\ABC_company, then after the CD \ command is used, the current directory will become C:\

cd ..

In the example above, CD command is used with two dots, which changes the current directory to the parent of the current directory. So if your current directory is C:\BR\data\companies\ABC_company, then after the CD .. command is used, the current directory will become C:\BR\data\companies

cd ..\..

In the example above, CD command is used with acombination of two dots, a backslash, and two more dots, which changes the current directory to the parent of the parent of the current directory. So if your current directory is C:\BR\data\companies\ABC_company, then after the CD ..\.. command is used, the current directory will become C:\BR\data