< Back
Select-FileSystemForm
Post
NAME Select-FileSystemForm
SYNOPSIS
Open or save files or open folders using Windows forms.
SYNTAX
Select-FileSystemForm [[-Start] <String>] [[-Description] <String>] [-Ext <String>] [-File] [-Save]
[<CommonParameters>]
DESCRIPTION
Launch a Windows form to allow user selction of files and folders on local or network files systems.
PARAMETERS
-Start <String>
[string] The start directory for the form.
Default value: Last path used
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Description <String>
[string] Text that is included on the chrome of the form and writen to the console window.
Default value: Select <Folder/File> to <Open/Save>
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Ext <String>
[string] Adds an extension filter to file open or save forms.
Default value *.*
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-File [<SwitchParameter>]
[switch] When present this switch uses file open or save forms. Used with the Save switch.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Save [<SwitchParameter>]
[switch] When used with the File switch launches a file save form. When not present launches a file open form.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
User form input.
OUTPUTS
Full path of Folder or file
NOTES
Author : Glen Buktenica
Version : 1.0.1 20190826 Release
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Select-FileSystemForm -Start ([Environment]::GetFolderPath('MyDocuments')) -Description "Save File" -Ext
"csv" -File -Save
Windows save file form filtered for *.csv defaulting to the current users my documents folder and the description
"Save File"
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>$TextFile = Select-FileSystemForm -File -Ext txt -Start c:\\scripts | ForEach {Get-Content $_}
Windows file open form will open at location c:\\scripts if present. Selected text file(s) will then be read into
$TextFile.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Select-FileSystemForm -ErrorAction Stop
Windows folder open form will open. If the cancel button is pressed script processing will stop.
RELATED LINKS
SYNOPSIS
Open or save files or open folders using Windows forms.
SYNTAX
Select-FileSystemForm [[-Start] <String>] [[-Description] <String>] [-Ext <String>] [-File] [-Save]
[<CommonParameters>]
DESCRIPTION
Launch a Windows form to allow user selction of files and folders on local or network files systems.
PARAMETERS
-Start <String>
[string] The start directory for the form.
Default value: Last path used
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Description <String>
[string] Text that is included on the chrome of the form and writen to the console window.
Default value: Select <Folder/File> to <Open/Save>
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Ext <String>
[string] Adds an extension filter to file open or save forms.
Default value *.*
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-File [<SwitchParameter>]
[switch] When present this switch uses file open or save forms. Used with the Save switch.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Save [<SwitchParameter>]
[switch] When used with the File switch launches a file save form. When not present launches a file open form.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
User form input.
OUTPUTS
Full path of Folder or file
NOTES
Author : Glen Buktenica
Version : 1.0.1 20190826 Release
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Select-FileSystemForm -Start ([Environment]::GetFolderPath('MyDocuments')) -Description "Save File" -Ext
"csv" -File -Save
Windows save file form filtered for *.csv defaulting to the current users my documents folder and the description
"Save File"
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>$TextFile = Select-FileSystemForm -File -Ext txt -Start c:\\scripts | ForEach {Get-Content $_}
Windows file open form will open at location c:\\scripts if present. Selected text file(s) will then be read into
$TextFile.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Select-FileSystemForm -ErrorAction Stop
Windows folder open form will open. If the cancel button is pressed script processing will stop.
RELATED LINKS