Include scripts in PowerShell GUI project

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.
Locked
User avatar
timstspry17
Posts: 45
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Sun Sep 06, 2015 9:31 pm

Include scripts in PowerShell GUI project

Post by timstspry17 »

Hello, I would like to know if in a PowerShell project you can include other scripts in like the form_load event? I would like to include a couple of scripts in the same directory as my powershell project and have their functions available to the form project like this:

.\getsomeinformation.ps1
.\getmoreinfo.ps1

so on and so forth.

Thanks!
Tim

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

Re: Include scripts in PowerShell GUI project

Post by jvierra »

Yes. Have you tried this in your form? Any scripts or modules can be loaded.
You need to use the script home folder and use the full path to the script.

User avatar
timstspry17
Posts: 45
Joined: Sun Sep 06, 2015 9:31 pm

Re: Include scripts in PowerShell GUI project

Post by timstspry17 »

Thank you for this information. Yes, I had tried it in my form project, but didn't use the full path to the scripts. This information is helpful, thanks so much!

Tim

Locked