1

I am kind of new to Powershell and just want to check if something is possible.

I understand there is a way to allow me to get the path of an individual file and even multiple files with the OpenFile dialog. I also understand there is a way for the user to select a folder with the folderbrowser dialog.

What I am looking for is a way for the user to select a path, whether that be a folder or a file(with multiselect).

I currently have a script which allows the user the select a folder path which is then used in my script:

Get-ChildItem -Path $folderBrowser.SelectedPath -Recurse -File |
ForEach-Object{
$_.creationtime=$($_.CreationTime.AddDays($daysTextBox.Text)) }

I want to update the existing script to allow for files or folders to be selected rather than duplicating the script.

I've searched extensively online but so far I haven't found anything.

Andy James
  • 11
  • 2
  • I dont think there is a windows form allowing to pick folder or file with multi-select function. IMH, I would create a message box to let the user select: "Pick a folder", "Pick a file", "Cancel/Done" - the user selects either multiple folder and/or multiple files - the result is your data to process further. – Adis1102 Sep 14 '20 at 09:05

1 Answers1

0

Thanks for your reply.

I’ve decided to create a tabbed form and have one tab for folders and one tab for individual items.

Andy James
  • 11
  • 2