How to create a form and select a powershell script from a drop and run the script

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Post Reply
johnson54937
Posts: 10
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Tue Apr 21, 2020 9:51 am

How to create a form and select a powershell script from a drop and run the script

Post by johnson54937 »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build:Powershell studio 2020
32 or 64 bit version of product:64
Operating system:
32 or 64 bit OS:Win 10 Pro - 10.0.18363

*** Please add details and screenshots as needed below. ***

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM


I see in your 'help files' a step-by-step to create a form to select a ps1 file and run, getting the results in a text box...
How would you implement a 'drop down' object to allow user to select the file stored in a folder in the project..to run

User avatar
Alexander Riedel
Posts: 7344
Joined: Tue May 29, 2007 4:43 pm

Re: How to create a form and select a powershell script from a drop and run the script

Post by Alexander Riedel »

[Topic moved by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.

jvierra
Posts: 14368
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: How to create a form and select a powershell script from a drop and run the script

Post by jvierra »

Hi - Sorry I missed this.
To do what you ask you would need to get the folders in question and store them in a drop down listbox. TO run the file you can use the "SelectedIndexChanged" event to obtain the value and run it.

The Info Center has examples of how to use ComboBoxes and ListBoxes.

Post Reply