Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Asynchronous Invoke

$
0
0

hi powerShell,

I am written in powershell script called through a c# (WPF).
Here is my sample code:

using (PowerShell PowerShellInstance = PowerShell.Create())
{
   PowerShellInstance.AddScript("Get-Content 'H:\aa.txt' | ForEach-Object {( $_ -replace \"\\s+\",\",\" )} | Out-File -FilePath .\\converted.csv -Encoding OEM");

   PowerShellInstance.Invoke();

}

I need to progress and finished status. E.g
if PowerShellInstance.Invoke() is still progress then
   lblText1.txt = "Loading..."

and if porgress is done then
lblText1.txt = "Finished"

Any Idea?

Thanks


Viewing all articles
Browse latest Browse all 6937

Trending Articles