Cmdlet
Read-ConsolePath
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 SetsDescription
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
EXAMPLE 1
Read-ConsolePath -Title 'Value'Parameters
- -BasePath String
- The folder relative paths start from (default: the current location).
- -Default String
- The default path.
- -Description String
- Help text under the question.
- -Extension String[]
- File extensions offered as suggestions (.csv, .json).
- -Kind PathKind
- What is accepted: Any, File or Folder.
- Possible values:
Any,File,Folder - -Mode InteractionMode
- 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
- Requires the path to exist.
- -ParameterName String
- The parameter of your script that supplies this value without a prompt (named in the non-interactive error, for example -Domain).
- -Title String
- 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.