Path Chose manually with a File Browser


I’m new here and I’m trying something with Powershell:

Instead of writing my $Path I’d like to create a $Path where I could search manually a folder using the file browser,

When launching my script I would search the location and the script would proceed instead of modifying the path each time,



Welcome to the forum. Here’s a basic example.

Add-Type -AssemblyName System.Windows.Forms
$fileBrowser = New-Object System.Windows.Forms.OpenFileDialog
$fileBrowser.ShowDialog() | Out-Null
$path = $fileBrowser.FileName
Write-Output $path

The OpenFileDialog class several options, so check the Microsoft documentation for more details such as using multi-select and setting an initial directory.