Browse For Folder Dialog Box

The getdir command displays the Browse for Folder dialog box and prints the selected directory path. It's syntax is as follows:

getdir [<title>="Browse For Folder" [<startupdir>=<current_directory> [<errormsg>="" [<isforwardslash>="true"]]]]

The "title" is the title of the Browse for Folder dialog box. It's default value is "Browse For Folder".

The "startupdir" is the initial directory of the Browse for Folder dialog box. By default the current working directory is shown as the initial directory. The specified path should have forward slash '/' as the path separator and not the backward slash.

The "errormsg" is the message which gets printed when the user closes the Browse for Folder dialog box without selecting any directory. By default no error message is displayed.

The "isforwardslash" specifies the path separator of the directory path which will be printed on screen. It can have values "true" or "false". By default forward slash is used as a path separator. If "false" is specified the backward slash '\' is used as a path separator.

Note: The parameters "title", "startupdir" and "errormsg" may be empty strings (""). In this case, the default values are used.

Example: getdir "Select Folder" D:/ "No folder selected" false

The above command displays a Browse for Folder dialog box with title "Select Folder". The initial directory is set to D:\ drive. "No folder selected" is the error message shown if user does not select any folder and the output i.e. the directory path is printed with backward slash '\' as the path separator.

Note that the arguments which contain spaces are enclosed within a pair of double quotes.


Documentation Index Page