1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
$CodigoC = @" using System; using System.Diagnostics; using System.Threading; public class Proceso { public static void Main() { Process myProcess; myProcess = Process.Start(@"C:\Windows\System32\Notepad.exe" ); Thread.Sleep(2000); myProcess.Kill(); // Free resources associated with process. myProcess.Close(); } } "@ Add-Type -TypeDefinition $CodigoC -ErrorAction SilentlyContinue [Proceso]::Main() |