![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Dot sourcing multiple code files Hi am new to PowerShell scripting/programming. I am trying to created a couple of "libraries" from which code can be reused. I have created two ..ps1 files one with functions that perform some general tasks and another that contains some variables that contain non-changing data. I a specific script that I create I am able to dot source the file with the functions. But when I try and another external file (the one with variables) I loose the functionality of the first (function) file, and cannot access the functionality from the first second file that I dot sourced. Is there a way I can create multiple libraries that can simultaneously be accessed by one or more scripts, with out having to incorporate these functionality in the libraries into the Windows PowerShell profile (config file). Let me know if you need more info to clarify my problem and the solution I'm seeking. Thanks |
| | #2 (permalink) | ||||||||||||
| Guest | Re: Dot sourcing multiple code files "henry Macoy" <henry.macoy@xxxxxx> wrote in message news:%23rDWxI%23AIHA.3780@xxxxxx
You can dot source more than one file within a script eg .. "C:\Users\Me\MyFunctions.ps1" .. "C:\Users\Me\MyVariables.ps1" or you're perhaps encountering a scope issue Get-Help about_Scope Otherwise you may wish to rephrase the question. -- Jon | ||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||
| Guest | Re: Dot sourcing multiple code files I would recommend reading the profile that comes with PSCX. It is pretty clear and it does exactly what you want. "Jon" <Email_Address@xxxxxx> wrote in message news:e2I4%23A$AIHA.1212@xxxxxx
| ||||||||||||||||||||||||
| | #4 (permalink) | ||||||||||||
| Guest | Re: Dot sourcing multiple code files henry Macoy wrote:
what's going wrong in your case. -- Hal Rottenberg Blog: http://halr9000.com Webmaster, Psi (http://psi-im.org) Co-host, PowerScripting Podcast (http://powerscripting.net) | ||||||||||||
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multiple .snk files | Greyhound | .NET General | 1 | 07-09-2008 08:08 PM |
| Possible to Read only Selected lines from multiple files into anotherfile deleting source files when processed? | joe.hurzeler | PowerShell | 3 | 03-09-2008 10:03 PM |
| does .dot-sourcing a set of functions compile these into MSIL? | Bob Landau | PowerShell | 4 | 10-09-2007 03:05 PM |
| Vista Code = Multiple Problems | ByeByeBirdie | Vista General | 6 | 10-05-2007 09:43 PM |
| sourcing a file in a script | JasonM | PowerShell | 5 | 08-31-2007 03:22 PM |