The usage of commands provided by Windows OS in the command operating manner for MASI software

I. Launch the Command Prompt

Method 1: Right Click on the ¡°Start¡± button of the lower left on Windows Desktop

Click ¡°Run¡±, a dialog form will pop up. Type ¡°cmd¡± in the area and click OK.

The console pops up.

Method 2: Click on the ¡°Start¡± button of the lower left on Windows Desktop

Click on Start-> Windows System-> Command Prompt

The console pops up.

 

II. Basic concepts

Currently working directory: the most left side to > is the currently working directory. The path marked by the red rectangle in the following figure is the currently working directory. When typing filename, auto-completion is realized via TAB key if the file is in the directory.

 

\: is to divide levels of the hierarchical files. Before \ is the upper layer of directory and after \ is the next layer of directory.

. or .\ means the current directory.

.. or ..\ means the previous level of directory.

 

For instance,

 

Change disk and return to the currently working directory in the disk: typing the name of disk followed by colon.

For instance,

 

Option of the commands provided by Windows OS is to begin by /, which is followed by a specific character.

/?: print the help information of the command

For instance,

 

 

The options /P, /Q of the command are both to begin with /.

 

III. The commonly used commands

 

cd: change directory.

For instance,

 

dir: listing files and directory

If directly typing ¡°dir¡± which is not followed by any options, the files and directories included in the currently working directory will be listed. For instance,

 

If files and directories included in a specific directory need to be displayed, please type dir followed by the specific directory. For instance,

 

More information about the command, please print the help information of the command:

>dir /?

 

cls: clearing the terminal screen

exit: exiting the current command processor

More commands, please refer to some corresponding documents.

 

IV. Piping and redirection

output redirection: >, >>

>: placing the output in file, as opposed to displaying it at terminal. If the file does not exist, a new one is created. If the file exists, it will clobber any existing data in the file.

>>: placing the output in file, as opposed to displaying it at terminal. If the file does not exist, a new one is created. If the file exists, it will append output to the end of the file.

 

For instance,

 

The content of filelist.txt is displayed as follows:

 

piping: |

Command 1| Command 2: the piping operator is placed between two commands. Output of Command 1 is taken as the input of Command 2. Commands can be connected as pipe.

 

For instance,

 

Output of command, dir, is used as input of command more, which paginates text so that one can view files containing more than one screen of text.

more: a command to view the contents of a text file one screen at a time

 

V. Environment variables

>set

Displaying the environment variables of system and its contents

 

>set Path

Displaying the contents of the environment variable, Path

 

Command set can also be used to set values of environment variables. Please refer to some corresponding documents.

 

If environment variable is called in batch file, the environment variable needs to be embraced by % (both before and after the variable). For instance, %CD% means the currently working directory.

 

VI. Batch file (.bat file)

Batch file of Windows OS is a text file with .bat extension. The file includes a series of commands. When the batch file is executed, the commands in the file execute in sequence resulting in batch processing.

 

A simple example (point clouds files with .dat extension are translated to point clouds with LAS file format in mode of batch) is shown as follows:

 

The batch file, transformLas.bat, includes 16 commands of txt2las.exe. Execution of transformLas.bat is equal to serially executing the 16 commands.

 

VII. Application of combination

It will promote efficiency that combining commands with the function of column editing provided by some editors. For instance, in order to get the list of files in a directory, the following can be used.

>dir >> filelist.txt

The list of files is redirected to the file, filelist.txt. Then, the file is edited and column editing is used to copy all filenames.

 

Meanwhile, column editing also supports typing, deleting and pasting operations. It will largely promote the efficiency.

 

VIII. Tips

(1) In order to reduce errors in typing path and filename and to save time, a new way can be used to replace typing on console. A file is selected in explorer and then the file can be drawn to console. The absolute path and filename of the file will be automatically displayed on console.

 

(2) The current path in explorer can be copied and pasted to console. The operation is to first click right key of mouse when the mouse is on the top of console and then to select paste on the drop-down menu. Command, cd, can be used to change the pasted path as the working directory. Filename can also be appended to the path by typing characters on console.

 

(3) When the path and filename are typed on console, the auto-completion can be used via TAB key.