-
I corrected my issues. Thanks, you were right. It was a typo. It should be . .\test.ps1 [Note the space between dots] & this article from Snover clears all doubts regarding dot-sourcing... http://blogs.msdn.com/b/powershell/archive/2007/06/19/get-scriptdirectory.aspx - Brilliant !!!
-
Hi, I need to remove / unload constant global variables when a module gets removed using the remove- module cmdlet. Additionally, the remove- variable documentation in MSDN says - You cannot use this cmdlet to delete variables that are set as constants or those that are owned by the system. - http://technet.microsoft.com/en-us/library/dd347612.aspx Is there any workaround or hack ?
-
Sorry, I think I am missing something. I tried what you suggested, but I get the following error. I ran using Powershell x86 command prompt shell as well as ISE. I am running from the directory where the file is saved i.e. same level The term '..\Test.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:12 + ..\Test.ps1 <<<<
-
But, is it possible to call any function directly inside the loaded .ps1 files [as you say above] directly like Modules ? I am asking this because I am struggling to call a parameterised function inside a ps1 file using dot-sourcing from command line- function f([string]$a, [string]$b) { Write-Host "a:", $a, " b:", $b } Save the above as Test.ps1 and load from the commad prompt as .\Test.ps1 & then call the function as f "a" "b" I get following error -
-
Hi, I am now breaking down my requirements step by stpe. I have a new question very specific to modules - http://powershell.com/cs/forums/t/9672.aspx Hope I am clear now
-
Hi, I want to organize functions into multiple .psm1 files and have them loaded by a single Module Manifest file (.psd1) . So, the .psd1 and multiple .psm1 files would sit under the same "module_name/" directory. Only the .psd1 file would need to have the same name as the module. I think it should be possible. Can anyone help me out please ?
-
I had posted my question on stackoverflow here - - http://stackoverflow.com/questions/9601733/powershell-generate-and-execute-scripts-on-the-fly-programmatically Thanks in advance.