Hi Guys,
may be you are wondering what is its meaning, it mean how we can use PowerShell with in a PowerShell as a child process
It is very useful when we want to call a cmdlets or script within PowerShell Script.
Syntax
Syntax is Simple type PowerShell following by Curly Braces and in Curly braces you can provide any script, or cmdlet.
PowerShell { }
for example open PowerShell console and type the below command:
powershell {Get-ChildItem c:\}
How we know that its the above command running as Child Process not as a same process.
okays I have a proof.
Currently there is only one “PowerShell.exe ” process is running.[fig.1]
now execute our command as let’s see what happens [fig.2]
now see below when we execute the script a new child “PowerShell.exe” process starts beneath our old “PowerShell.exe” process and when it done executing it the child process will exit automatically [fig.3]
hope u like it :)
thanks
aman dhally
Nice start Aman.
ReplyDeletethanks Saravpreet ...
ReplyDelete