# Current script pathMost people have of course used Add-Type and Import-Module. However, what about including others .ps1 files? The above works well for me. How do you do it?
$RUN_DIR = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
# References
Add-Type -Assembly System.Configuration
[System.Reflection.Assembly]::LoadFrom($RUN_DIR + "\lib\ICSharpCode.SharpZipLib.dll")
# Includes
. ($RUN_DIR + '\inc\Common.ps1')
. ($RUN_DIR + '\inc\PathUtils.ps1')
. ($RUN_DIR + '\inc\PathHelper.ps1')
Import-Module ($MY_DIR + '\inc\ArchiveUtils.psm1')
. ($RUN_DIR + '\configs\general_settings.ps1')
. ($RUN_DIR + '\configs\mail_settings.ps1')
July 1, 2009
Powershell and Includes
When I work with Powershell I always break out files into multiple .ps1 files. The way I include them looks like this:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment