Skip to content
ConsoleMonster
Cmdlet

Read-ConsolePath

Module ConsoleMonster
Inputs
None
Outputs
System.String

Asks for a file or folder path, with completion.

Syntax

Read-ConsolePath [-BasePath <String>] [-Default <String>] [-Description <String>] [-Extension <String[]>] [-Kind <Any|File|Folder>] [-Mode <Rich|Line|Accessible>] [-MustExist] [-ParameterName <String>] [-Title] <String> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Asks for a file or folder path, with completion.

Matching entries of the typed folder are listed under the box (folders first); Tab completes the common part or the focused entry, Up and Down move through them. -Kind File or Folder and -MustExist are checked on Enter. Returns the path as typed (environment variables and ~ are expanded only when checking).

Examples

Authored help example

EXAMPLE 1

Read-ConsolePath -Title 'Value'

Parameters

-BasePath String optional
The folder relative paths start from (default: the current location).
-Default String optional
The default path.
-Description String optional
Help text under the question.
-Extension String[] optional
File extensions offered as suggestions (.csv, .json).
-Kind PathKind optional
What is accepted: Any, File or Folder.
Possible values: Any, File, Folder
-Mode InteractionMode optional
Forces how to ask: Rich (in-place prompt), Line (question and typed answer), Accessible (numbered, no redraws) or None (use the default or fail).
Possible values: Rich, Line, Accessible
-MustExist SwitchParameter optional
Requires the path to exist.
-ParameterName String optionalaliases: Parameter
The parameter of your script that supplies this value without a prompt (named in the non-interactive error, for example -Domain).
-Title String requiredposition: 0aliases: Prompt, Question
The question.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.