Is it posible to using powershell to display some files in powershell
i try to run a function so it could display files in a GUI shell that contains files,
and open when click it
i was looking for some hint code so i could start using this
It sounds like what you’re looking for is the Windows Explorer …
Since I did not really get what you’re looking for you should elaborate more detailed what you’re looking for.
You may search for “PowerShell File Open Dialog”
I was looking for a Powershell GUI like system.windows.form,which i just learn about ,thanks
actually i was looking for powershell GUI that creating shell that could contains series of files inside the shell GUI, that i could use function to open the shell ,so i could choose it from the shell
$form = New-Object System.Windows.Forms.Form
$form.Text = "My Form"
$guiObjects[0] =New-Object System.Windows.Forms.Button
$guiObjects[0].text ="Object 0"
$form.Controls.Add($guiobject[0])
$guiObjects[1] =New-Object System.Windows.Forms.Button
$guiObjects[1].text ="Object 1"
$form.Controls.Add($guiObjects[1])
$form.ShowDialog()
The Out-ConsoleGridView cmdlet from the [Microsoft.PowerShell.ConsoleGuiTools](https://github.com/PowerShell/ConsoleGuiTools)
module will allow you to do what you want:
get-childitem -path "c:\" `
| out-consolegridview -OutputMode Multiple `
| ForEach-Object {
start-process "Explorer.exe" -ArgumentList $_.fullname
}
wtf.
it is cool,never though such project exist ,thx for sharing ,i am still building the project to open the file from powershell grid,because i hate using GUI,so want to open it with powershell but still need to open explorer because sometimes i forgot about the name
By design the sample code provided previously will require that you update the path to your desired path before running the command. The following code will allow you to start with an initial path and you can traverse into child directories and launch files from console. Though, a little more work needs to be done if you want to traverse back up the tree.
function consoleFileOpener {
param($path)
get-childitem -path $path `
| out-consolegridview -OutputMode Single `
| ForEach-Object {
if ($_.PSIsContainer) {
consoleFileOpener -path $_.fullname
} else {
start-process $_.fullname
}
}
}
$initialPath = "C:\"
consoleFileOpener -path $initialPath