I would like to automatically launch a powershell and run a few commands from another powershell (I want to start it from another powershell because of the advantages of functions).
I would like to do so because I’m testing a *.dll coded in C# with powershell and I have to constantly launch and quit powershell because it’s not possible to unload a dll in powershell and therefore it’s not possible to reload the library with its classes.
Is there a way to automate powershell just like the com-object automation with office?
What about just using a script or script blocks?
should work.
If you need interactivity and need to try multiple commands at will, you could use
In that case it can be useful to at least change the prompt color so you know whether you’re in the test sub-shell or in the parent one:
I tend to define a small function in the following way too:
which allows me to close PowerShell with Ctrl+D, Enter (half an analog to Unix shells).